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 FinancialGuaranteeStatusChangeEventHandlerTests() { context = new TestIwsContext(); var userContext = new TestUserContext(UserId); handler = new FinancialGuaranteeStatusChangeEventHandler(context, userContext); context.Users.Add(UserFactory.Create(UserId, AnyString, AnyString, AnyString, AnyString)); financialGuarantee = new FinancialGuaranteeCollection(new Guid("68787AC6-7CF5-4862-8E7E-77E20172AECC")).AddFinancialGuarantee(new DateTime(2015, 1, 1)); receivedEvent = new FinancialGuaranteeStatusChangeEvent(financialGuarantee, FinancialGuaranteeStatus.ApplicationReceived); }
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 AddExistingFinancialGuarantee(FinancialGuarantee financialGuarantee) { FinancialGuaranteesCollection.Add(financialGuarantee); }
public void SetCompletedDate_BeforeReceivedDate_Throws() { Assert.Throws <InvalidOperationException>(() => FinancialGuarantee.Complete(AnyDate.AddDays(-1))); }
public void SetCompletedDate_AfterReceivedDate_SetsDate() { FinancialGuarantee.Complete(AnyDate.AddDays(1)); Assert.Equal(AnyDate.AddDays(1), FinancialGuarantee.CompletedDate); }