コード例 #1
0
        public void AddsOutputFormatter()
        {
            // Arrange
            var optionsSetup = new XmlSerializerMvcOptionsSetup(Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
            var options      = new MvcOptions();

            // Act
            optionsSetup.Configure(options);

            // Assert
            Assert.IsType <XmlSerializerOutputFormatter>(Assert.Single(options.OutputFormatters));
        }
コード例 #2
0
        public void AddsFormatterMapping()
        {
            // Arrange
            var optionsSetup = new XmlSerializerMvcOptionsSetup(Options.Create(new MvcXmlOptions()), NullLoggerFactory.Instance);
            var options      = new MvcOptions();

            // Act
            optionsSetup.Configure(options);

            // Assert
            var mappedContentType = options.FormatterMappings.GetMediaTypeMappingForFormat("xml");

            Assert.Equal("application/xml", mappedContentType);
        }