public FinancialGuaranteeTests() { FinancialGuaranteeCollection = new FinancialGuaranteeCollection(NotificationId); FinancialGuarantee = FinancialGuaranteeCollection.AddFinancialGuarantee(AnyDate); CompletedFinancialGuarantee = FinancialGuaranteeCollection.AddFinancialGuarantee(AnyDate); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.Status, FinancialGuaranteeStatus.ApplicationComplete, CompletedFinancialGuarantee); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.ReceivedDate, AnyDate, CompletedFinancialGuarantee); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.CompletedDate, CompletedDate, CompletedFinancialGuarantee); ApprovedFinancialGuarantee = FinancialGuaranteeCollection.AddFinancialGuarantee(AnyDate); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.Status, FinancialGuaranteeStatus.Approved, ApprovedFinancialGuarantee); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.Decision, FinancialGuaranteeDecision.Approved, ApprovedFinancialGuarantee); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.ReceivedDate, AnyDate, ApprovedFinancialGuarantee); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.CompletedDate, CompletedDate, ApprovedFinancialGuarantee); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.DecisionDate, AfterCompletionDate, ApprovedFinancialGuarantee); RefusedFinancialGuarantee = FinancialGuaranteeCollection.AddFinancialGuarantee(AnyDate); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.Status, FinancialGuaranteeStatus.Refused, RefusedFinancialGuarantee); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.Decision, FinancialGuaranteeDecision.Refused, RefusedFinancialGuarantee); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.ReceivedDate, AnyDate, RefusedFinancialGuarantee); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.CompletedDate, CompletedDate, RefusedFinancialGuarantee); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.DecisionDate, AfterCompletionDate, RefusedFinancialGuarantee); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.RefusalReason, AnyString, RefusedFinancialGuarantee); ReceivedFinancialGuarantee = FinancialGuaranteeCollection.AddFinancialGuarantee(AnyDate); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.Status, FinancialGuaranteeStatus.ApplicationReceived, ReceivedFinancialGuarantee); ObjectInstantiator<FinancialGuarantee>.SetProperty(fg => fg.ReceivedDate, AnyDate, ReceivedFinancialGuarantee); Dispatcher = A.Fake<IDeferredEventDispatcher>(); DomainEvents.Dispatcher = Dispatcher; }
public void GetCurrentApprovedFinancialGuarantee_NewGuaranteeCreated_ReturnsExpected() { var newFinancialGuarantee = financialGuaranteeCollection.AddFinancialGuarantee(today); newFinancialGuarantee.Complete(today); Assert.Equal(approvedFinancialGuaranteeId, financialGuaranteeCollection.GetCurrentApprovedFinancialGuarantee().Id); }
public FinancialGuaranteeTests() { FinancialGuaranteeCollection = new FinancialGuaranteeCollection(NotificationId); FinancialGuarantee = FinancialGuaranteeCollection.AddFinancialGuarantee(AnyDate); CompletedFinancialGuarantee = FinancialGuaranteeCollection.AddFinancialGuarantee(AnyDate); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.Status, FinancialGuaranteeStatus.ApplicationComplete, CompletedFinancialGuarantee); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.ReceivedDate, AnyDate, CompletedFinancialGuarantee); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.CompletedDate, CompletedDate, CompletedFinancialGuarantee); ApprovedFinancialGuarantee = FinancialGuaranteeCollection.AddFinancialGuarantee(AnyDate); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.Status, FinancialGuaranteeStatus.Approved, ApprovedFinancialGuarantee); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.Decision, FinancialGuaranteeDecision.Approved, ApprovedFinancialGuarantee); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.ReceivedDate, AnyDate, ApprovedFinancialGuarantee); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.CompletedDate, CompletedDate, ApprovedFinancialGuarantee); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.DecisionDate, AfterCompletionDate, ApprovedFinancialGuarantee); RefusedFinancialGuarantee = FinancialGuaranteeCollection.AddFinancialGuarantee(AnyDate); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.Status, FinancialGuaranteeStatus.Refused, RefusedFinancialGuarantee); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.Decision, FinancialGuaranteeDecision.Refused, RefusedFinancialGuarantee); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.ReceivedDate, AnyDate, RefusedFinancialGuarantee); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.CompletedDate, CompletedDate, RefusedFinancialGuarantee); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.DecisionDate, AfterCompletionDate, RefusedFinancialGuarantee); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.RefusalReason, AnyString, RefusedFinancialGuarantee); ReceivedFinancialGuarantee = FinancialGuaranteeCollection.AddFinancialGuarantee(AnyDate); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.Status, FinancialGuaranteeStatus.ApplicationReceived, ReceivedFinancialGuarantee); ObjectInstantiator <FinancialGuarantee> .SetProperty(fg => fg.ReceivedDate, AnyDate, ReceivedFinancialGuarantee); Dispatcher = A.Fake <IDeferredEventDispatcher>(); DomainEvents.Dispatcher = Dispatcher; }
public FinancialGuaranteeCollectionTests() { SystemTime.Freeze(today); financialGuaranteeCollection = new FinancialGuaranteeCollection(notificationId); var approvedFinancialGuarantee = financialGuaranteeCollection.AddFinancialGuarantee(today.AddDays(-10)); EntityHelper.SetEntityId(approvedFinancialGuarantee, approvedFinancialGuaranteeId); approvedFinancialGuarantee.Complete(today.AddDays(-9)); approvedFinancialGuarantee.Approve(new ApprovalData(today.AddDays(-8), "123", 10, false)); }
public void Create_GeneratesObjectwithExpectedValues() { SystemTime.Freeze(); var fg = FinancialGuaranteeCollection.AddFinancialGuarantee(AnyDate); Assert.Equal(SystemTime.UtcNow, fg.CreatedDate); Assert.Equal(FinancialGuaranteeStatus.ApplicationReceived, fg.Status); SystemTime.Unfreeze(); }
public FinancialGuaranteeApprovalTests() { SystemTime.Freeze(today); repository = A.Fake<IFinancialGuaranteeRepository>(); financialGuaranteeCollection = new FinancialGuaranteeCollection(notificationId); var approvedFinancialGuarantee = financialGuaranteeCollection.AddFinancialGuarantee(today.AddDays(-10)); EntityHelper.SetEntityId(approvedFinancialGuarantee, approvedFinancialGuaranteeId); approvedFinancialGuarantee.Complete(today.AddDays(-9)); approvedFinancialGuarantee.Approve(new ApprovalData(today.AddDays(-8), "123", 10, false)); var newFinancialGuarantee = financialGuaranteeCollection.AddFinancialGuarantee(today.AddDays(-5)); newFinancialGuarantee.Complete(today.AddDays(-4)); EntityHelper.SetEntityId(newFinancialGuarantee, financialGuaranteeId); A.CallTo(() => repository.GetByNotificationId(notificationId)).Returns(financialGuaranteeCollection); approval = new FinancialGuaranteeApproval(repository); }
public FinancialGuaranteeCollectionTests() { SystemTime.Freeze(today); financialGuaranteeCollection = new FinancialGuaranteeCollection(notificationId); var approvedFinancialGuarantee = financialGuaranteeCollection.AddFinancialGuarantee(today.AddDays(-10)); EntityHelper.SetEntityId(approvedFinancialGuarantee, approvedFinancialGuaranteeId); approvedFinancialGuarantee.Complete(today.AddDays(-9)); approvedFinancialGuarantee.Approve(new ApprovalData(today.AddDays(-8), "123", 10, false, (decimal)12.34, (decimal)56.78)); }
private static FinancialGuaranteeCollection GetFinancialGuarantee(FinancialGuaranteeStatus status) { var collection = new FinancialGuaranteeCollection(NotificationId); var fg = collection.AddFinancialGuarantee(Today); ObjectInstantiator <FinancialGuarantee> .SetProperty(f => f.ActiveLoadsPermitted, 2, fg); ObjectInstantiator <FinancialGuarantee> .SetProperty(f => f.Status, status, fg); return(collection); }
private static FinancialGuaranteeCollection GetFinancialGuarantee() { var collection = new FinancialGuaranteeCollection(NotificationId); var fg = collection.AddFinancialGuarantee(new DateTime(2015, 1, 1)); ObjectInstantiator <FinancialGuarantee> .SetProperty(f => f.ActiveLoadsPermitted, 2, fg); ObjectInstantiator <FinancialGuarantee> .SetProperty(f => f.Status, FinancialGuaranteeStatus.Approved, fg); return(collection); }
public FinancialGuaranteeApprovalTests() { SystemTime.Freeze(today); repository = A.Fake <IFinancialGuaranteeRepository>(); financialGuaranteeCollection = new FinancialGuaranteeCollection(notificationId); var approvedFinancialGuarantee = financialGuaranteeCollection.AddFinancialGuarantee(today.AddDays(-10)); EntityHelper.SetEntityId(approvedFinancialGuarantee, approvedFinancialGuaranteeId); approvedFinancialGuarantee.Complete(today.AddDays(-9)); approvedFinancialGuarantee.Approve(new ApprovalData(today.AddDays(-8), "123", 10, false, (decimal)12.34, (decimal)56.78)); var newFinancialGuarantee = financialGuaranteeCollection.AddFinancialGuarantee(today.AddDays(-5)); newFinancialGuarantee.Complete(today.AddDays(-4)); EntityHelper.SetEntityId(newFinancialGuarantee, financialGuaranteeId); A.CallTo(() => repository.GetByNotificationId(notificationId)).Returns(financialGuaranteeCollection); approval = new FinancialGuaranteeApproval(repository); }
public async Task FGDecisionMade_ReturnsFalse(FinancialGuaranteeStatus status) { var assessment = new NotificationAssessment(NotificationId); ObjectInstantiator <NotificationAssessment> .SetProperty(x => x.Status, NotificationStatus.Consented, assessment); var financialGuaranteeCollection = new FinancialGuaranteeCollection(NotificationId); var financialGuarantee = financialGuaranteeCollection.AddFinancialGuarantee(new DateTime(2015, 1, 1)); ObjectInstantiator <FinancialGuarantee> .SetProperty(x => x.Status, status, financialGuarantee); A.CallTo(() => assessmentRepository.GetByNotificationId(NotificationId)).Returns(assessment); A.CallTo(() => financialGuaranteeRepository.GetByNotificationId(NotificationId)).Returns(financialGuaranteeCollection); var result = await service.Calculate(NotificationId); Assert.False(result); }
private static FinancialGuaranteeCollection GetFinancialGuarantee(FinancialGuaranteeStatus status) { var collection = new FinancialGuaranteeCollection(NotificationId); var fg = collection.AddFinancialGuarantee(Today); ObjectInstantiator<FinancialGuarantee>.SetProperty(f => f.ActiveLoadsPermitted, 2, fg); ObjectInstantiator<FinancialGuarantee>.SetProperty(f => f.Status, status, fg); return collection; }