コード例 #1
0
        public void Validate_NoError()
        {
            var learner = SetupLearner("NONE");

            var validationErrorHandlerMock = new Mock<IValidationErrorHandler>();
            Expression<Action<IValidationErrorHandler>> handle = veh => veh.Handle("MathGrade_03", null, null, null);

            var learnerFamQueryService = new Mock<ILearnerFAMQueryService>();
            learnerFamQueryService.Setup(x => x.HasAnyLearnerFAMCodesForType(It.IsAny<IEnumerable<ILearnerFAM>>(), It.IsAny<string>(), It.IsAny<IEnumerable<long>>()))
                .Returns(true);

            var rule = new MathGrade_04Rule(validationErrorHandlerMock.Object, learnerFamQueryService.Object);
            rule.Validate(learner);
            validationErrorHandlerMock.Verify(handle, Times.Never);
        }
コード例 #2
0
        public void ConditionMet_True(long famCode)
        {
            var learnerFamQueryService = new LearnerFAMQueryService();
            var learnerFams            = new[]
            {
                new TestLearnerFAM()
                {
                    LearnFAMType         = "MCF",
                    LearnFAMCodeNullable = famCode
                }
            };

            var rule = new MathGrade_04Rule(null, learnerFamQueryService);

            rule.ConditionMet("XYZ", learnerFams).Should().BeTrue();
        }