public void ResultModify_WhenCommandApplied_ValidModifiedLineItemAdded() { var result = new MpResult(); CreateMpResultCommand cmdCreate = DefaultCreateMpResultCommand(); result.Apply(cmdCreate); AddMpLineItemsCommand cmdLineItem = DefaultAddMpLineItemsCommand(2, cmdCreate.ApplyToResult, result.PollingCentre, result.ResultSender); result.Apply(cmdLineItem); ConfirmMpResultsCommand cmdConfirm = DefaultConfirmPresidentalResultsCommand(3, cmdLineItem.ApplyToResult, result.PollingCentre, result.ResultSender); result.Apply(cmdConfirm); ModifyMpResultsCommand cmd = DefaultModifyMpResultsCommand(4, cmdConfirm.ApplyToResult, result.PollingCentre, result.ResultSender); //act result.Apply(cmd); //assert Assert.That(result.LineItems.Count(), Is.EqualTo(2)); Assert.That(result.Id, Is.EqualTo(cmd.ApplyToResult.Id)); Assert.That(result.Status, Is.EqualTo(ResultStatus.Modified)); MpResultLineItem lineItem = result.LineItems[1]; Assert.That(lineItem.Candidate, Is.EqualTo(cmd.ResultDetail[0].Candidate)); Assert.That(lineItem.ResultCount, Is.EqualTo(cmd.ResultDetail[0].Result)); }
public void ResultAddLineItem_WhenCommandApplied_ValidLineItemAdded() { var result = new MpResult(); CreateMpResultCommand cmdCreate = DefaultCreateMpResultCommand(); result.Apply(cmdCreate); AddMpLineItemsCommand cmd = DefaultAddMpLineItemsCommand(2, cmdCreate.ApplyToResult, result.PollingCentre, result.ResultSender); //act result.Apply(cmd); //assert Assert.That(result.LineItems.Count(), Is.EqualTo(1)); Assert.That(result.Id, Is.EqualTo(cmd.ApplyToResult.Id)); Assert.That(result.Status, Is.EqualTo(ResultStatus.New)); MpResultLineItem lineItem = result.LineItems[0]; Assert.That(lineItem.Candidate, Is.EqualTo(cmd.ResultDetail[0].Candidate)); Assert.That(lineItem.ResultCount, Is.EqualTo(cmd.ResultDetail[0].Result)); }