diff --git a/test/System.Net.Http.Formatting.Test/Formatting/DataContractJsonMediaTypeFormatterTests.cs b/test/System.Net.Http.Formatting.Test/Formatting/DataContractJsonMediaTypeFormatterTests.cs index e1966f72a..ad3311326 100644 --- a/test/System.Net.Http.Formatting.Test/Formatting/DataContractJsonMediaTypeFormatterTests.cs +++ b/test/System.Net.Http.Formatting.Test/Formatting/DataContractJsonMediaTypeFormatterTests.cs @@ -157,6 +157,7 @@ public async Task ReadFromStreamAsync_RoundTripsWriteToStreamAsync_KnownTypes(Ty } } +#if !NETCOREAPP2_0 // DBNull not serializable on .NET Core 2.0. // Test alternate null value [Fact] public async Task ReadFromStreamAsync_RoundTripsWriteToStreamAsync_DBNull() @@ -187,6 +188,7 @@ public async Task ReadFromStreamAsync_RoundTripsWriteToStreamAsync_DBNullAsEmpty // Lower levels convert DBNull.Value to empty string on read Assert.Equal(String.Empty, readObj); } +#endif [Fact] public async Task UseDataContractJsonSerializer_Default() diff --git a/test/System.Net.Http.Formatting.Test/Formatting/XmlMediaTypeFormatterTests.cs b/test/System.Net.Http.Formatting.Test/Formatting/XmlMediaTypeFormatterTests.cs index c539ed1d4..2bec6ccf8 100644 --- a/test/System.Net.Http.Formatting.Test/Formatting/XmlMediaTypeFormatterTests.cs +++ b/test/System.Net.Http.Formatting.Test/Formatting/XmlMediaTypeFormatterTests.cs @@ -23,8 +23,23 @@ public class XmlMediaTypeFormatterTests : MediaTypeFormatterTestBase BunchOfTypedObjectsTestData = new RefTypeTestData( - () => new List { null, String.Empty, "This is a string", false, true, Double.MinValue, - Double.MaxValue, Int32.MinValue, Int32.MaxValue, Int64.MinValue, Int64.MaxValue, DBNull.Value, }); + () => new List + { + null, + String.Empty, + "This is a string", + false, + true, + Double.MinValue, + Double.MaxValue, + Int32.MinValue, + Int32.MaxValue, + Int64.MinValue, + Int64.MaxValue, +#if !NETCOREAPP2_0 // DBNull not serializable on .NET Core 2.0. + DBNull.Value, +#endif + }); public static IEnumerable BunchOfTypedObjectsTestDataCollection {