THRIFT-5511 Full support for the new net6 "nullability" semantics
Client: netstd
Patch: Jens Geyer
This closes #2516
diff --git a/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs b/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs
index 778d24c..49108d1 100644
--- a/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs
+++ b/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs
@@ -83,8 +83,8 @@
[TestMethod]
public void TCollection_Set_Equals_Primitive_Test()
{
- var collection1 = new THashSet<int> {1,2,3};
- var collection2 = new THashSet<int> {1,2,3};
+ var collection1 = new HashSet<int> {1,2,3};
+ var collection2 = new HashSet<int> {1,2,3};
Assert.IsTrue(TCollections.Equals(collection1, collection2));
Assert.IsTrue(collection1.SequenceEqual(collection2));
}
@@ -92,8 +92,8 @@
[TestMethod]
public void TCollection_Set_Equals_Primitive_Different_Test()
{
- var collection1 = new THashSet<int> { 1, 2, 3 };
- var collection2 = new THashSet<int> { 1, 2 };
+ var collection1 = new HashSet<int> { 1, 2, 3 };
+ var collection2 = new HashSet<int> { 1, 2 };
Assert.IsFalse(TCollections.Equals(collection1, collection2));
Assert.IsFalse(collection1.SequenceEqual(collection2));
@@ -105,8 +105,8 @@
[TestMethod]
public void TCollection_Set_Equals_Objects_Test()
{
- var collection1 = new THashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
- var collection2 = new THashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
+ var collection1 = new HashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
+ var collection2 = new HashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
Assert.IsTrue(TCollections.Equals(collection1, collection2));
Assert.IsTrue(collection1.SequenceEqual(collection2));
}
@@ -114,8 +114,8 @@
[TestMethod]
public void TCollection_Set_Set_Equals_Objects_Test()
{
- var collection1 = new THashSet<THashSet<ExampleClass>> { new THashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } } };
- var collection2 = new THashSet<THashSet<ExampleClass>> { new THashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } } };
+ var collection1 = new HashSet<HashSet<ExampleClass>> { new HashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } } };
+ var collection2 = new HashSet<HashSet<ExampleClass>> { new HashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } } };
Assert.IsTrue(TCollections.Equals(collection1, collection2));
Assert.IsFalse(collection1.SequenceEqual(collection2)); // SequenceEqual() calls Equals() of the inner list instead of SequenceEqual()
}
@@ -123,7 +123,7 @@
[TestMethod]
public void TCollection_Set_Equals_OneAndTheSameObject_Test()
{
- var collection1 = new THashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
+ var collection1 = new HashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
var collection2 = collection1; // references to one and the same collection
Assert.IsTrue(TCollections.Equals(collection1, collection2));
Assert.IsTrue(collection1.SequenceEqual(collection2));
diff --git a/lib/netstd/Tests/Thrift.Tests/Collections/THashSetTests.cs b/lib/netstd/Tests/Thrift.Tests/Collections/THashSetTests.cs
index 8de573e..73921ea 100644
--- a/lib/netstd/Tests/Thrift.Tests/Collections/THashSetTests.cs
+++ b/lib/netstd/Tests/Thrift.Tests/Collections/THashSetTests.cs
@@ -1,4 +1,4 @@
-// Licensed to the Apache Software Foundation(ASF) under one
+// Licensed to the Apache Software Foundation(ASF) under one
// or more contributor license agreements.See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.The ASF licenses this file
@@ -22,6 +22,8 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Thrift.Collections;
+#pragma warning disable IDE0063 // simplify using
+
namespace Thrift.Tests.Collections
{
// ReSharper disable once InconsistentNaming
@@ -33,7 +35,7 @@
{
const int value = 1;
- var hashSet = new THashSet<int> {value};
+ var hashSet = new HashSet<int> {value};
Assert.IsTrue(hashSet.Contains(value));