From 8198fe1a165332a50535bc2447e45989bffbd864 Mon Sep 17 00:00:00 2001 From: Eric Erhardt Date: Thu, 2 Jun 2022 14:10:54 +0000 Subject: [PATCH] Skip HostAbortedExceptionTests when BinaryFormatter isn't supported Fix #70132 --- .../tests/UnitTests/HostAbortedExceptionTests.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/HostAbortedExceptionTests.cs b/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/HostAbortedExceptionTests.cs index 974a1ba58c85a2..759f508fad0df0 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/HostAbortedExceptionTests.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/HostAbortedExceptionTests.cs @@ -37,7 +37,7 @@ public void TestException(string? message, bool innerException) Assert.Equal(message, thrownException.Message); } - [Theory] + [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsBinaryFormatterSupported))] [InlineData("Test Message")] [InlineData(null)] public void TestSerialization(string? message) @@ -55,8 +55,9 @@ public void TestSerialization(string? message) Assert.Null(deserializedException.InnerException); } - [Fact] - public void TestSerializationDefaultConstructor() { + [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsBinaryFormatterSupported))] + public void TestSerializationDefaultConstructor() + { var exception = new HostAbortedException(); using var serializationStream = new MemoryStream();