Пример #1
0
        public void Constructor_Should_CreateInvalidModelException_With1Error()
        {
            var exception = new ValidationErrorException <string>("memberName", "error1", "error2");

            exception.StatusCode.Should().Be(HttpStatusCode.BadRequest);
            exception.HelpLink.Should().Be(ResponseStatusCodeLink.BadRequest);
            exception.Errors.Should().HaveCount(1);
        }
Пример #2
0
        public void Constructor_Should_CreateInvalidModelException_With2Errors()
        {
            var errors = new Dictionary <string, string[]>();

            errors.Add("memberName1", new[] { "error1", "error2" });
            errors.Add("memberName2", new[] { "error1", "error2" });

            var exception = new ValidationErrorException <string>(errors);

            exception.StatusCode.Should().Be(HttpStatusCode.BadRequest);
            exception.HelpLink.Should().Be(ResponseStatusCodeLink.BadRequest);
            exception.Errors.Should().HaveCount(2);
        }