Ejemplo n.º 1
0
        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_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));
        }
Ejemplo n.º 3
0
        public void Exclude_False()
        {
            var learningDelivery = new TestLearningDelivery()
            {
                LearningDeliveryFAMs = new TestLearningDeliveryFAM[] { }
            };

            var learningDeliveryFAMQueryServiceMock = new Mock<ILearningDeliveryFAMQueryService>();

            learningDeliveryFAMQueryServiceMock.Setup(qs => qs.HasLearningDeliveryFAMCodeForType(learningDelivery.LearningDeliveryFAMs, "SOF", "1")).Returns(false);

            var uln_02 = new ULN_02Rule(learningDeliveryFAMQueryServiceMock.Object, null);

            uln_02.Exclude(learningDelivery).Should().BeFalse();
        }
        public void Exclude_False_NoMatch()
        {
            var uln_02 = new ULN_02Rule(null);

            var learningDelivery = new MessageLearnerLearningDelivery()
            {
                LearningDeliveryFAM = new MessageLearnerLearningDeliveryLearningDeliveryFAM[]
                {
                    new MessageLearnerLearningDeliveryLearningDeliveryFAM()
                    {
                        LearnDelFAMType = "SOF",
                        LearnDelFAMCode = "2"
                    }
                }
            };

            uln_02.Exclude(learningDelivery).Should().BeFalse();
        }
        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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        public void ConditionMet_False_FundModel()
        {
            var uln_02 = new ULN_02Rule(null, null);

            uln_02.ConditionMet(1, 9999999999).Should().BeFalse();
        }
Ejemplo n.º 8
0
        public void ConditionMet_False_Uln()
        {
            var uln_02 = new ULN_02Rule(null, null);

            uln_02.ConditionMet(10, 1).Should().BeFalse();
        }
Ejemplo n.º 9
0
        public void ConditionMet_True(long fundModel)
        {
            var uln_02 = new ULN_02Rule(null, null);

            uln_02.ConditionMet(fundModel, 9999999999).Should().BeTrue();
        }