Example #1
0
            public void Should_map_PropertyName_to_Extensions()
            {
                // Arrange
                var sut = new SimpleProblemDetailsMapper();
                var validationFailure = new ValidationFailure("TestProp", "Test error")
                {
                    ErrorCode = "Code123",
                };

                // Act
                var actual = sut.Map(validationFailure);

                // Assert
                Assert.Equal("TestProp", actual.Extensions["propertyName"]);
            }
Example #2
0
            public void Should_map_ErrorMessage_to_Detail()
            {
                // Arrange
                var sut = new SimpleProblemDetailsMapper();
                var validationFailure = new ValidationFailure("TestProp", "Test error")
                {
                    ErrorCode = "Code123",
                };

                // Act
                var actual = sut.Map(validationFailure);

                // Assert
                Assert.Equal("Test error", actual.Detail);
            }