public void Validate_Errors() { var validationErrorHandlerMock = new Mock <IValidationErrorHandler <MessageLearner> >(); var messageLearner = new MessageLearner() { ULN = 9999999999, LearningDelivery = new MessageLearnerLearningDelivery[] { new MessageLearnerLearningDelivery() { FundModel = 10, }, new MessageLearnerLearningDelivery() { FundModel = 99, } } }; Expression <Action <IValidationErrorHandler <MessageLearner> > > handle = veh => veh.Handle(messageLearner, "ULN_02"); validationErrorHandlerMock.Setup(handle); var uln_02 = new ULN_02Rule(validationErrorHandlerMock.Object); uln_02.Validate(messageLearner); validationErrorHandlerMock.Verify(handle, Times.Exactly(2)); }
public void Validate_Errors() { var messageLearner = new TestLearner() { ULNNullable = 9999999999, LearningDeliveries = new TestLearningDelivery[] { new TestLearningDelivery() { FundModelNullable = 10, }, new TestLearningDelivery() { FundModelNullable = 99, } } }; var validationErrorHandlerMock = new Mock<IValidationErrorHandler>(); var learningDeliveryFAMQueryServiceMock = new Mock<ILearningDeliveryFAMQueryService>(); learningDeliveryFAMQueryServiceMock.Setup(qs => qs.HasLearningDeliveryFAMCodeForType(It.IsAny<IEnumerable<ILearningDeliveryFAM>>(), "SOF", "1")).Returns(false); Expression<Action<IValidationErrorHandler>> handle = veh => veh.Handle("ULN_02", null, null, null); validationErrorHandlerMock.Setup(handle); var uln_02 = new ULN_02Rule(learningDeliveryFAMQueryServiceMock.Object, validationErrorHandlerMock.Object); uln_02.Validate(messageLearner); validationErrorHandlerMock.Verify(handle, Times.Exactly(2)); }
public void Validate_NoErrors() { var validationErrorHandlerMock = new Mock <IValidationErrorHandler <MessageLearner> >(); var uln_02 = new ULN_02Rule(validationErrorHandlerMock.Object); var messageLearner = new MessageLearner() { ULN = 1, LearningDelivery = new MessageLearnerLearningDelivery[] { new MessageLearnerLearningDelivery() { FundModel = 2, } } }; uln_02.Validate(messageLearner); }
public void Validate_NoErrors() { var messageLearner = new TestLearner() { ULNNullable = 1, LearningDeliveries = new TestLearningDelivery[] { new TestLearningDelivery() { FundModelNullable = 2, } } }; var learningDeliveryFAMQueryServiceMock = new Mock<ILearningDeliveryFAMQueryService>(); learningDeliveryFAMQueryServiceMock.Setup(qs => qs.HasLearningDeliveryFAMCodeForType(It.IsAny<IEnumerable<ILearningDeliveryFAM>>(), "SOF", "1")).Returns(false); var uln_02 = new ULN_02Rule(learningDeliveryFAMQueryServiceMock.Object, null); uln_02.Validate(messageLearner); }