diff --git a/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/ContentWrapperAttributeTests.cs b/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/ContentWrapperAttributeTests.cs index 476838e564a..ff180dfd613 100644 --- a/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/ContentWrapperAttributeTests.cs +++ b/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/ContentWrapperAttributeTests.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable using System.Collections.Generic; using Xunit; @@ -13,24 +12,24 @@ public class ContentWrapperAttributeTests [Theory] [InlineData(null)] [InlineData(typeof(int))] - public void Ctor_Type(Type contentWrapper) + public void Ctor_Type(Type? contentWrapper) { - var attribute = new ContentWrapperAttribute(contentWrapper); + var attribute = new ContentWrapperAttribute(contentWrapper!); Assert.Equal(contentWrapper, attribute.ContentWrapper); } public static IEnumerable Equals_TestData() { var attribute = new ContentWrapperAttribute(typeof(int)); - yield return new object[] { attribute, attribute, true }; - yield return new object[] { attribute, new ContentWrapperAttribute(typeof(int)), true }; - yield return new object[] { attribute, new ContentWrapperAttribute(typeof(string)), false }; - yield return new object[] { attribute, new ContentWrapperAttribute(null), false }; - yield return new object[] { new ContentWrapperAttribute(null), new ContentWrapperAttribute(null), true }; - yield return new object[] { new ContentWrapperAttribute(null), new ContentWrapperAttribute(typeof(int)), false }; - - yield return new object[] { attribute, new object(), false }; - yield return new object[] { attribute, null, false }; + yield return new object?[] { attribute, attribute, true }; + yield return new object?[] { attribute, new ContentWrapperAttribute(typeof(int)), true }; + yield return new object?[] { attribute, new ContentWrapperAttribute(typeof(string)), false }; + yield return new object?[] { attribute, new ContentWrapperAttribute(null!), false }; + yield return new object?[] { new ContentWrapperAttribute(null!), new ContentWrapperAttribute(null!), true }; + yield return new object?[] { new ContentWrapperAttribute(null!), new ContentWrapperAttribute(typeof(int)), false }; + + yield return new object?[] { attribute, new object(), false }; + yield return new object?[] { attribute, null, false }; } [Theory] @@ -50,7 +49,7 @@ public void GetHashCode_Invoke_ReturnsExpected() [Fact] public void GetHashCode_InvokeNullContentWrapper_ReturnsZero() { - var attribute = new ContentWrapperAttribute(null); + var attribute = new ContentWrapperAttribute(null!); Assert.Equal(0, attribute.GetHashCode()); } diff --git a/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XamlDeferLoadAttributeTests.cs b/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XamlDeferLoadAttributeTests.cs index 11fc4c93351..28a8faa228b 100644 --- a/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XamlDeferLoadAttributeTests.cs +++ b/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XamlDeferLoadAttributeTests.cs @@ -24,13 +24,13 @@ public void Ctor_Type_Type(Type loaderType, Type contentType) [Fact] public void Ctor_NullLoaderType_ThrowsArgumentNullException() { - Assert.Throws("loaderType", () => new XamlDeferLoadAttribute(null, typeof(int))); + Assert.Throws("loaderType", () => new XamlDeferLoadAttribute(null!, typeof(int))); } [Fact] public void Ctor_NullContentType_ThrowsArgumentNullException() { - Assert.Throws("contentType", () => new XamlDeferLoadAttribute(typeof(int), null)); + Assert.Throws("contentType", () => new XamlDeferLoadAttribute(typeof(int), null!)); } [Theory] @@ -48,13 +48,13 @@ public void Ctor_String_String(string loaderType, string contentType) [Fact] public void Ctor_NullLoaderTypeName_ThrowsArgumentNullException() { - Assert.Throws("loaderType", () => new XamlDeferLoadAttribute(null, "contentType")); + Assert.Throws("loaderType", () => new XamlDeferLoadAttribute(null!, "contentType")); } [Fact] public void Ctor_NullContentTypeName_ThrowsArgumentNullException() { - Assert.Throws("contentType", () => new XamlDeferLoadAttribute("loaderType", null)); + Assert.Throws("contentType", () => new XamlDeferLoadAttribute("loaderType", null!)); } } } diff --git a/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XmlnsCompatibleWithAttributeTests.cs b/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XmlnsCompatibleWithAttributeTests.cs index 23d60383bcf..4b71c659dda 100644 --- a/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XmlnsCompatibleWithAttributeTests.cs +++ b/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XmlnsCompatibleWithAttributeTests.cs @@ -21,12 +21,12 @@ public void Ctor_String_String(string oldNamespace, string newNamespace) [Fact] public void Ctor_NullOldNamespace_ThrowsArgumentNullException() { - Assert.Throws("oldNamespace", () => new XmlnsCompatibleWithAttribute(null, "newNamespace")); + Assert.Throws("oldNamespace", () => new XmlnsCompatibleWithAttribute(null!, "newNamespace")); } [Fact] public void Ctor_NullNewNamespace_ThrowsArgumentNullException() { - Assert.Throws("newNamespace", () => new XmlnsCompatibleWithAttribute("oldNamespace", null)); + Assert.Throws("newNamespace", () => new XmlnsCompatibleWithAttribute("oldNamespace", null!)); } } diff --git a/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XmlnsDefinitionAttributeTests.cs b/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XmlnsDefinitionAttributeTests.cs index f1ae0f6237e..38e014d59e4 100644 --- a/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XmlnsDefinitionAttributeTests.cs +++ b/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XmlnsDefinitionAttributeTests.cs @@ -22,12 +22,12 @@ public void Ctor_String_String(string xmlNamespace, string clrNamespace) [Fact] public void Ctor_NullXmlNamespace_ThrowsArgumentNullException() { - Assert.Throws("xmlNamespace", () => new XmlnsDefinitionAttribute(null, "clrNamespace")); + Assert.Throws("xmlNamespace", () => new XmlnsDefinitionAttribute(null!, "clrNamespace")); } [Fact] public void Ctor_NullClrNamespace_ThrowsArgumentNullException() { - Assert.Throws("clrNamespace", () => new XmlnsDefinitionAttribute("xmlNamespace", null)); + Assert.Throws("clrNamespace", () => new XmlnsDefinitionAttribute("xmlNamespace", null!)); } } diff --git a/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XmlnsPrefixAttributeTests.cs b/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XmlnsPrefixAttributeTests.cs index 4cdc46a8a92..f8b2c744725 100644 --- a/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XmlnsPrefixAttributeTests.cs +++ b/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/XmlnsPrefixAttributeTests.cs @@ -21,12 +21,12 @@ public void Ctor_String_String(string xmlNamespace, string prefix) [Fact] public void Ctor_NullXmlNamespace_ThrowsArgumentNullException() { - Assert.Throws("xmlNamespace", () => new XmlnsPrefixAttribute(null, "prefix")); + Assert.Throws("xmlNamespace", () => new XmlnsPrefixAttribute(null!, "prefix")); } [Fact] public void Ctor_NullPrefix_ThrowsArgumentNullException() { - Assert.Throws("prefix", () => new XmlnsPrefixAttribute("xmlNamespace", null)); + Assert.Throws("prefix", () => new XmlnsPrefixAttribute("xmlNamespace", null!)); } }