Exemplo n.º 1
0
        public void Handle()
        {
            var validationErrorHandler = new ValidationErrorHandler();

            validationErrorHandler.Handle("RuleName");

            validationErrorHandler.ErrorBag.Should().HaveCount(1);
        }
Exemplo n.º 2
0
        public void Handle_ErrorMessageParameters()
        {
            var validationErrorHandler = new ValidationErrorHandler();

            validationErrorHandler.Handle("RuleName", "LearnRefNumber", 1234, new string[] { "error", "message", "parameters" });

            var validationError = validationErrorHandler.ErrorBag.First();

            validationError.RuleName.Should().Be("RuleName");
            validationError.LearnerReferenceNumber.Should().Be("LearnRefNumber");
            validationError.AimSequenceNumber.Should().Be(1234);
            validationError.ErrorMessageParameters.Should().Equal(new string[] { "error", "message", "parameters" });
        }
Exemplo n.º 3
0
        public void Handle_AimSequenceNumber()
        {
            var validationErrorHandler = new ValidationErrorHandler();

            validationErrorHandler.Handle("RuleName", "LearnRefNumber", 1234);

            var validationError = validationErrorHandler.ErrorBag.First();

            validationError.RuleName.Should().Be("RuleName");
            validationError.LearnerReferenceNumber.Should().Be("LearnRefNumber");
            validationError.AimSequenceNumber.Should().Be(1234);
            validationError.ErrorMessageParameters.Should().BeNull();
        }
Exemplo n.º 4
0
        public void HandleParallel()
        {
            var validationErrorHandler = new ValidationErrorHandler();

            Parallel.For(0, 1000, (i) =>
            {
                validationErrorHandler.Handle(i.ToString());
            });

            for (int i = 0; i < 1000; i++)
            {
                validationErrorHandler.ErrorBag.Should().ContainSingle(eb => eb.RuleName == i.ToString());
            }
        }