public void AddsFormatterMapping() { // Arrange var optionsSetup = new MvcXmlSerializerMvcOptionsSetup(NullLoggerFactory.Instance); var options = new MvcOptions(); // Act optionsSetup.Configure(options); // Assert var mappedContentType = options.FormatterMappings.GetMediaTypeMappingForFormat("xml"); Assert.Equal("application/xml", mappedContentType); }
public void DoesNotOverrideExistingMapping() { // Arrange var optionsSetup = new MvcXmlSerializerMvcOptionsSetup(NullLoggerFactory.Instance); var options = new MvcOptions(); options.FormatterMappings.SetMediaTypeMappingForFormat("xml", "text/xml"); // Act optionsSetup.Configure(options); // Assert var mappedContentType = options.FormatterMappings.GetMediaTypeMappingForFormat("xml"); Assert.Equal("text/xml", mappedContentType); }