This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var businessMock = new Mock<IDocumentBusiness>(); | |
businessMock.Setup(b => b.EnsureCanCancelRevision(It.Is<Document>(calledDocument => calledDocument.Equals(document)))); | |
businessMock.Verify(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Fact(DisplayName = @" | |
GIVEN | |
that document Atendence List is published | |
AND SteveJobs is the elaborator | |
AND SteveJobs requested a new revision | |
AND the request is still open | |
AND SteveJobs has an open and closed revision request | |
WHEN | |
I replace SteveJobs with MrCatra | |
THEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WebformsComponentCodeBehind | |
{ | |
public List<TrainingEffectiveness> TrainingEffectiveness { get; private set; } | |
public List<TrainingEvaluations> TrainingEvaluations { get; private set; } | |
protected string GetClass(string code, bool approve) | |
{ | |
// Don't bother these | |
var evaluation = TrainingEvaluations.Find(x => x.EmployeeCode == code.Split('_')[0] && x.CriteriaCode == code.Split('_')[1]); | |
var criteriaHasEvaluation = evaluation.Any(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Request | |
{ | |
public Request(string code, bool approve, TrainingEvaluations evaluations, TrainningEffectiveness effectiveness) | |
{ | |
CriteriaHasEvaluation = evaluations.Find(x => x.EmployeeCode == code.Split('_')[0] && x.CriteriaCode == code.Split('_')[1]).Any(); | |
IsNew = code.Split('_')[1] == IEntity.NewCode; | |
Effectiveness = effectiveness.Find(x => x.EmployeeCode == code.Split('_')[0]); | |
HasEffectiveness = effectiveness.Any(); | |
Approve = approve; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected string GetClass(string code, bool approve) | |
{ | |
var request = new Request(code, approve, TrainingEvaluations, TrainningEffectiveness); | |
if (request.CriteriaHasEvaluation) | |
{ | |
return request.Evaluation.IsEvaluated | |
? request.Approve | |
? request.Evaluation.IsApproved | |
? "approvedOn" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Label | |
{ | |
private Label(string Result) | |
{ | |
Value = Result; | |
} | |
public string Value { get; } | |
public static Label ApprovedOn => new Label("approvedOn"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class RuleHandler { | |
private RuleHandler _nextRule; | |
public RuleHandler NextRule (RuleHandler nextRule) { | |
_nextRule = nextRule; | |
return nextRule; | |
} | |
public virtual Label Run (Request request) => _nextRule.Run(request); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (request.CriteriaHasEvaluation) | |
{ | |
return request.Evaluation.IsEvaluated | |
? request.Approve | |
? request.Evaluation.IsApproved | |
? "approvedOn" | |
: "approvedOff" | |
: !request.Evaluation.IsApproved | |
? "reprovedOn" | |
: "reprovedOff" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CriteriaHasEvaluation : RuleHandler { | |
public override Label Run(Request request) | |
{ | |
if(request.CriteriaHasEvaluation) | |
{ | |
return request.Evaluation.IsEvaluated | |
? request.Approve | |
? request.Evaluation.IsApproved | |
? Label.Approved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!hasEffectiveness) return approve ? "approvedOff" : "reprovedOff"; |