From 4591bff76a5f7f07dfd92d1215a55435413b8f39 Mon Sep 17 00:00:00 2001 From: Stefan Nikolei Date: Tue, 3 Sep 2024 20:45:13 +0200 Subject: [PATCH] add explicit test for null as encoding --- .../StreamWriter/StreamWriter.CtorTests.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime/tests/System.IO.Tests/StreamWriter/StreamWriter.CtorTests.cs b/src/libraries/System.Runtime/tests/System.IO.Tests/StreamWriter/StreamWriter.CtorTests.cs index bf768cf9ff725b..bf0075139e699d 100644 --- a/src/libraries/System.Runtime/tests/System.IO.Tests/StreamWriter/StreamWriter.CtorTests.cs +++ b/src/libraries/System.Runtime/tests/System.IO.Tests/StreamWriter/StreamWriter.CtorTests.cs @@ -48,7 +48,13 @@ public static void UnicodeEncoding() TestEncoding(System.Text.Encoding.Unicode, "This is Unicode\u00FF"); } - private static void TestEncoding(System.Text.Encoding encoding, string testString) + [Fact] + public static void NullEncoding() + { + TestEncoding(null, "This is UTF8\u00FF"); + } + + private static void TestEncoding(System.Text.Encoding? encoding, string testString) { StreamWriter sw2; StreamReader sr2;