public void IsODataFormatter_ReturnsTrue_For_Derived_ODataFormatters() { // Arrange HttpConfiguration configuration = new HttpConfiguration(); ODataMediaTypeFormatter formatter1 = CreateODataFormatter(); DerivedODataMediaTypeFormatter formatter2 = new DerivedODataMediaTypeFormatter(new ODataPayloadKind[0]); configuration.Formatters.Add(formatter1); configuration.Formatters.Add(formatter2); // Act IEnumerable <MediaTypeFormatter> result = configuration.Formatters.Where(f => f != null && Decorator.GetInner(f) is ODataMediaTypeFormatter); // Assert IEnumerable <MediaTypeFormatter> expectedFormatters = new MediaTypeFormatter[] { formatter1, formatter2 }; Assert.True(expectedFormatters.SequenceEqual(result)); }
public void GetODataFormatters_ReturnsFormatter_IfSet() { // Arrange HttpConfiguration configuration = new HttpConfiguration(); ODataMediaTypeFormatter formatter1 = CreateODataFormatter(); ODataMediaTypeFormatter formatter2 = CreateODataFormatter(); configuration.Formatters.Add(formatter1); configuration.Formatters.Add(formatter2); // Act IEnumerable <MediaTypeFormatter> result = configuration.GetODataFormatters(); // Assert IEnumerable <MediaTypeFormatter> expectedFormatters = new MediaTypeFormatter[] { formatter1, formatter2 }; Assert.True(expectedFormatters.SequenceEqual(result)); }