THRIFT-5746 Upgrade to net8
Client: netstd
Patch: Jens Geyer
diff --git a/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj b/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
index 98e8007..3f52a5f 100644
--- a/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
+++ b/lib/netstd/Tests/Thrift.IntegrationTests/Thrift.IntegrationTests.csproj
@@ -19,7 +19,8 @@
-->
<PropertyGroup>
- <TargetFramework>net7.0</TargetFramework>
+ <TargetFramework>net8.0</TargetFramework>
+ <LangVersion>latestMajor</LangVersion>
<AssemblyName>Thrift.IntegrationTests</AssemblyName>
<PackageId>Thrift.IntegrationTests</PackageId>
<Version>0.20.0.0</Version>
diff --git a/lib/netstd/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj b/lib/netstd/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj
index 6f3abb1..ecde366 100644
--- a/lib/netstd/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj
+++ b/lib/netstd/Tests/Thrift.PublicInterfaces.Compile.Tests/Thrift.PublicInterfaces.Compile.Tests.csproj
@@ -21,7 +21,8 @@
<PropertyGroup>
<ThriftVersion>0.20.0</ThriftVersion>
<ThriftVersionOutput>Thrift version $(ThriftVersion)</ThriftVersionOutput>
- <TargetFramework>net7.0</TargetFramework>
+ <TargetFramework>net8.0</TargetFramework>
+ <LangVersion>latestMajor</LangVersion>
<Version>$(ThriftVersion).0</Version>
<AssemblyName>Thrift.PublicInterfaces.Compile.Tests</AssemblyName>
<PackageId>Thrift.PublicInterfaces.Compile.Tests</PackageId>
@@ -68,14 +69,14 @@
<Error Condition="$('$(ThriftBinaryVersion)'::StartsWith('$(ThriftVersionOutput)')) == true" Text="Thrift version returned: '$(ThriftBinaryVersion)' is not equal to the projects version '$(ThriftVersionOutput)'." />
<Message Importance="high" Text="Generating tests with thrift binary: '$(PathToThrift)'" />
<!-- Generate the thrift test files -->
- <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./CassandraTest.thrift" />
- <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./optional_required_default.thrift" />
- <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./name_conflicts.thrift" />
- <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./../../../../test/ThriftTest.thrift" />
- <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./../../../../contrib/fb303/if/fb303.thrift" />
- <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./Thrift5253.thrift" />
- <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./Thrift5320.thrift" />
- <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net6 -r ./Thrift5382.thrift" />
+ <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./CassandraTest.thrift" />
+ <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./optional_required_default.thrift" />
+ <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./name_conflicts.thrift" />
+ <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./../../../../test/ThriftTest.thrift" />
+ <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./../../../../contrib/fb303/if/fb303.thrift" />
+ <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./Thrift5253.thrift" />
+ <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./Thrift5320.thrift" />
+ <Exec Command="$(PathToThrift) -gen netstd:wcf,union,serial,net8 -r ./Thrift5382.thrift" />
</Target>
</Project>
diff --git a/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs b/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs
index 49108d1..c6cd22d 100644
--- a/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs
+++ b/lib/netstd/Tests/Thrift.Tests/Collections/TCollectionsTests.cs
@@ -56,8 +56,8 @@
[TestMethod]
public void TCollection_List_Equals_Objects_Test()
{
- var collection1 = new List<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
- var collection2 = new List<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
+ var collection1 = new List<ExampleClass> { new() { X = 1 }, new() { X = 2 } };
+ var collection2 = new List<ExampleClass> { new() { X = 1 }, new() { X = 2 } };
Assert.IsTrue(TCollections.Equals(collection1, collection2));
Assert.IsTrue(collection1.SequenceEqual(collection2));
}
@@ -65,8 +65,8 @@
[TestMethod]
public void TCollection_List_List_Equals_Objects_Test()
{
- var collection1 = new List<List<ExampleClass>> { new List<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } } };
- var collection2 = new List<List<ExampleClass>> { new List<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } } };
+ var collection1 = new List<List<ExampleClass>> { new() { new() { X = 1 }, new() { X = 2 } } };
+ var collection2 = new List<List<ExampleClass>> { new() { new() { X = 1 }, new() { X = 2 } } };
Assert.IsTrue(TCollections.Equals(collection1, collection2));
Assert.IsFalse(collection1.SequenceEqual(collection2)); // SequenceEqual() calls Equals() of the inner list instead of SequenceEqual()
}
@@ -74,7 +74,7 @@
[TestMethod]
public void TCollection_List_Equals_OneAndTheSameObject_Test()
{
- var collection1 = new List<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
+ var collection1 = new List<ExampleClass> { new() { X = 1 }, new() { X = 2 } };
var collection2 = collection1;
Assert.IsTrue(TCollections.Equals(collection1, collection2));
Assert.IsTrue(collection1.SequenceEqual(collection2));
@@ -105,8 +105,8 @@
[TestMethod]
public void TCollection_Set_Equals_Objects_Test()
{
- 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 } };
+ var collection1 = new HashSet<ExampleClass> { new() { X = 1 }, new() { X = 2 } };
+ var collection2 = new HashSet<ExampleClass> { new() { X = 1 }, new() { 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 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 } } };
+ var collection1 = new HashSet<HashSet<ExampleClass>> { new() { new() { X = 1 }, new() { X = 2 } } };
+ var collection2 = new HashSet<HashSet<ExampleClass>> { new() { new() { X = 1 }, new() { 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 HashSet<ExampleClass> { new ExampleClass { X = 1 }, new ExampleClass { X = 2 } };
+ var collection1 = new HashSet<ExampleClass> { new() { X = 1 }, new() { X = 2 } };
var collection2 = collection1; // references to one and the same collection
Assert.IsTrue(TCollections.Equals(collection1, collection2));
Assert.IsTrue(collection1.SequenceEqual(collection2));
@@ -160,13 +160,13 @@
{
var collection1 = new Dictionary<int, ExampleClass>
{
- [1] = new ExampleClass { X = 1 },
- [-1] = new ExampleClass { X = 2 }
+ [1] = new() { X = 1 },
+ [-1] = new() { X = 2 }
};
var collection2 = new Dictionary<int, ExampleClass>
{
- [1] = new ExampleClass { X = 1 },
- [-1] = new ExampleClass { X = 2 }
+ [1] = new() { X = 1 },
+ [-1] = new() { X = 2 }
};
Assert.IsTrue(TCollections.Equals(collection1, collection2));
@@ -180,16 +180,16 @@
{
[0] = new Dictionary<int, ExampleClass>
{
- [1] = new ExampleClass { X = 1 },
- [-1] = new ExampleClass { X = 2 }
+ [1] = new() { X = 1 },
+ [-1] = new() { X = 2 }
}
};
var collection2 = new Dictionary<int, Dictionary<int, ExampleClass>>
{
[0] = new Dictionary<int, ExampleClass>
{
- [1] = new ExampleClass { X = 1 },
- [-1] = new ExampleClass { X = 2 }
+ [1] = new() { X = 1 },
+ [-1] = new() { X = 2 }
}
};
@@ -202,8 +202,8 @@
{
var collection1 = new Dictionary<int, ExampleClass>
{
- [1] = new ExampleClass { X = 1 },
- [-1] = new ExampleClass { X = 2 }
+ [1] = new() { X = 1 },
+ [-1] = new() { X = 2 }
};
var collection2 = collection1;
Assert.IsTrue(TCollections.Equals(collection1, collection2));
diff --git a/lib/netstd/Tests/Thrift.Tests/DataModel/DeepCopy.cs b/lib/netstd/Tests/Thrift.Tests/DataModel/DeepCopy.cs
index 11b5af4..7a43ca8 100644
--- a/lib/netstd/Tests/Thrift.Tests/DataModel/DeepCopy.cs
+++ b/lib/netstd/Tests/Thrift.Tests/DataModel/DeepCopy.cs
@@ -59,7 +59,7 @@
return instance;
}
- private jack? MakeNestedUnion(int nesting)
+ private jack.nested_struct? MakeNestedUnion(int nesting)
{
if (++nesting > 1)
return null;
@@ -148,14 +148,14 @@
if (nesting < 2)
{
- instance.Far_list = new List<Distance>() { Distance.foo, Distance.bar, Distance.baz };
- instance.Far_set = new HashSet<Distance>() { Distance.foo, Distance.bar, Distance.baz };
- instance.Far_map = new Dictionary<Distance, Distance>() { [Distance.foo] = Distance.foo, [Distance.bar] = Distance.bar, [Distance.baz] = Distance.baz };
+ instance.Far_list = [Distance.foo, Distance.bar, Distance.baz];
+ instance.Far_set = [Distance.foo, Distance.bar, Distance.baz];
+ instance.Far_map = new() { [Distance.foo] = Distance.foo, [Distance.bar] = Distance.bar, [Distance.baz] = Distance.baz };
- instance.Far_set_list = new HashSet<List<Distance>>() { new List<Distance>() { Distance.foo } };
- instance.Far_list_map_set = new List<Dictionary<sbyte, HashSet<Distance>>>() { new Dictionary<sbyte, HashSet<Distance>>() { [1] = new HashSet<Distance>() { Distance.baz } } };
+ instance.Far_set_list = [[Distance.foo]];
+ instance.Far_list_map_set = [new Dictionary<sbyte, HashSet<Distance>>() { [1] = [Distance.baz] }];
- instance.Far_map_dist_to_rds = new Dictionary<Distance, List<RaceDetails>>() { [Distance.bar] = new List<RaceDetails>() };
+ instance.Far_map_dist_to_rds = new() { [Distance.bar] = [] };
var details = MakeNestedRaceDetails(nesting);
if (details != null)
instance.Far_map_dist_to_rds[Distance.bar].Add(details);
@@ -265,8 +265,7 @@
if (++level > 4)
return value;
- if (value == null)
- value = MakeNestedUnion(0);
+ value ??= MakeNestedUnion(0);
Debug.Assert(value?.As_nested_struct != null);
ModifyInstance(value.As_nested_struct, level);
return value;
@@ -277,23 +276,21 @@
if (++level > 4)
return value;
- if (value == null)
- value = new RaceDetails();
+ value ??= new RaceDetails();
ModifyInstance(value,level);
return value;
}
private Dictionary<Distance, List<RaceDetails>> ModifyValue(Dictionary<Distance, List<RaceDetails>>? value, int level)
{
- if (value == null)
- value = new Dictionary<Distance, List<RaceDetails>>();
+ value ??= [];
if (++level > 4)
return value;
var details = new RaceDetails();
InitializeInstance(details);
- value[Distance.foo] = new List<RaceDetails>() { details };
+ value[Distance.foo] = [details];
if (value.TryGetValue(Distance.bar, out var list) && (list.Count > 0))
{
@@ -309,17 +306,16 @@
private static List<Dictionary<sbyte, HashSet<Distance>>> ModifyValue(List<Dictionary<sbyte, HashSet<Distance>>>? value)
{
- if (value == null)
- value = new List<Dictionary<sbyte, HashSet<Distance>>>();
+ value ??= [];
if (value.Count == 0)
- value.Add(new Dictionary<sbyte, HashSet<Distance>>());
+ value.Add([]);
//else
//value.Add(null); --Thrift does not allow null values in containers
sbyte key = (sbyte)(value[0].Count + 10);
if (value[0].Count == 0)
- value[0].Add(key, new HashSet<Distance>());
+ value[0].Add(key, []);
//else
//value[0].Add(key, null); --Thrift does not allow null values in containers
@@ -331,9 +327,7 @@
{
if (pair.Value != null)
{
- if (pair.Value.Contains(Distance.baz))
- pair.Value.Remove(Distance.baz);
- else
+ if (!pair.Value.Remove(Distance.baz))
pair.Value.Add(Distance.baz);
}
}
@@ -345,25 +339,22 @@
private static HashSet<List<Distance>> ModifyValue(HashSet<List<Distance>>? value)
{
- if (value == null)
- value = new HashSet<List<Distance>>();
+ value ??= [];
if (value.Count == 0)
- value.Add(new List<Distance>());
+ value.Add([]);
//else
//value.Add(null); -- Thrift does not allow null values in containers
foreach (var entry in value)
- if( entry != null)
- entry.Add(Distance.baz);
+ entry?.Add(Distance.baz);
return value;
}
private static Dictionary<Distance, Distance> ModifyValue(Dictionary<Distance, Distance>? value)
{
- if (value == null)
- value = new Dictionary<Distance, Distance>();
+ value ??= [];
value[Distance.foo] = value.ContainsKey(Distance.foo) ? ++value[Distance.foo] : Distance.foo;
value[Distance.bar] = value.ContainsKey(Distance.bar) ? ++value[Distance.bar] : Distance.bar;
value[Distance.baz] = value.ContainsKey(Distance.baz) ? ++value[Distance.baz] : Distance.baz;
@@ -372,22 +363,15 @@
private static HashSet<Distance> ModifyValue(HashSet<Distance>? value)
{
- if (value == null)
- value = new HashSet<Distance>();
+ value ??= [];
- if (value.Contains(Distance.foo))
- value.Remove(Distance.foo);
- else
+ if (!value.Remove(Distance.foo))
value.Add(Distance.foo);
- if (value.Contains(Distance.bar))
- value.Remove(Distance.bar);
- else
+ if (!value.Remove(Distance.bar))
value.Add(Distance.bar);
- if (value.Contains(Distance.baz))
- value.Remove(Distance.baz);
- else
+ if (!value.Remove(Distance.baz))
value.Add(Distance.baz);
return value;
@@ -395,8 +379,7 @@
private static List<Distance> ModifyValue(List<Distance>? value)
{
- if (value == null)
- value = new List<Distance>();
+ value ??= [];
value.Add(Distance.foo);
value.Add(Distance.bar);
value.Add(Distance.baz);
@@ -410,36 +393,32 @@
private static Dictionary<sbyte, short> ModifyValue(Dictionary<sbyte, short>? value)
{
- if (value == null)
- value = new Dictionary<sbyte, short>();
+ value ??= [];
value.Add((sbyte)(value.Count + 10), (short)value.Count);
return value;
}
private static HashSet<long> ModifyValue(HashSet<long>? value)
{
- if (value == null)
- value = new HashSet<long>();
+ value ??= [];
value.Add(value.Count+100);
return value;
}
private static List<int> ModifyValue(List<int>? value)
{
- if (value == null)
- value = new List<int>();
+ value ??= [];
value.Add(value.Count);
return value;
}
private static byte[] ModifyValue(byte[]? value)
{
- if (value == null)
- value = new byte[1] { 0 };
+ value ??= [0];
if (value.Length > 0)
value[0] = (value[0] < 0xFF) ? ++value[0] : (byte)0;
else
- value = new byte[1] { 0 };
+ value = [0];
return value;
}
diff --git a/lib/netstd/Tests/Thrift.Tests/DataModel/NullValuesSet.cs b/lib/netstd/Tests/Thrift.Tests/DataModel/NullValuesSet.cs
index 80eacc2..09f7251 100644
--- a/lib/netstd/Tests/Thrift.Tests/DataModel/NullValuesSet.cs
+++ b/lib/netstd/Tests/Thrift.Tests/DataModel/NullValuesSet.cs
@@ -25,6 +25,7 @@
using OptReqDefTest;
using Thrift.Collections;
+#pragma warning disable IDE0079 // net20 - unneeded suppression
#pragma warning disable IDE0017 // init can be simplified - we don't want that here
namespace Thrift.Tests.DataModel
diff --git a/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolHelperTests.cs b/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolHelperTests.cs
index 6d39151..03e3efa 100644
--- a/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolHelperTests.cs
+++ b/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolHelperTests.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
@@ -34,17 +34,17 @@
// input/output
var sets = new List<Tuple<TType, byte[]>>
{
- new Tuple<TType, byte[]>(TType.Bool, TJSONProtocolConstants.TypeNames.NameBool),
- new Tuple<TType, byte[]>(TType.Byte, TJSONProtocolConstants.TypeNames.NameByte),
- new Tuple<TType, byte[]>(TType.I16, TJSONProtocolConstants.TypeNames.NameI16),
- new Tuple<TType, byte[]>(TType.I32, TJSONProtocolConstants.TypeNames.NameI32),
- new Tuple<TType, byte[]>(TType.I64, TJSONProtocolConstants.TypeNames.NameI64),
- new Tuple<TType, byte[]>(TType.Double, TJSONProtocolConstants.TypeNames.NameDouble),
- new Tuple<TType, byte[]>(TType.String, TJSONProtocolConstants.TypeNames.NameString),
- new Tuple<TType, byte[]>(TType.Struct, TJSONProtocolConstants.TypeNames.NameStruct),
- new Tuple<TType, byte[]>(TType.Map, TJSONProtocolConstants.TypeNames.NameMap),
- new Tuple<TType, byte[]>(TType.Set, TJSONProtocolConstants.TypeNames.NameSet),
- new Tuple<TType, byte[]>(TType.List, TJSONProtocolConstants.TypeNames.NameList),
+ new(TType.Bool, TJSONProtocolConstants.TypeNames.NameBool),
+ new(TType.Byte, TJSONProtocolConstants.TypeNames.NameByte),
+ new(TType.I16, TJSONProtocolConstants.TypeNames.NameI16),
+ new(TType.I32, TJSONProtocolConstants.TypeNames.NameI32),
+ new(TType.I64, TJSONProtocolConstants.TypeNames.NameI64),
+ new(TType.Double, TJSONProtocolConstants.TypeNames.NameDouble),
+ new(TType.String, TJSONProtocolConstants.TypeNames.NameString),
+ new(TType.Struct, TJSONProtocolConstants.TypeNames.NameStruct),
+ new(TType.Map, TJSONProtocolConstants.TypeNames.NameMap),
+ new(TType.Set, TJSONProtocolConstants.TypeNames.NameSet),
+ new(TType.List, TJSONProtocolConstants.TypeNames.NameList),
};
foreach (var t in sets)
@@ -73,17 +73,17 @@
// input/output
var sets = new List<Tuple<TType, byte[]>>
{
- new Tuple<TType, byte[]>(TType.Bool, TJSONProtocolConstants.TypeNames.NameBool),
- new Tuple<TType, byte[]>(TType.Byte, TJSONProtocolConstants.TypeNames.NameByte),
- new Tuple<TType, byte[]>(TType.I16, TJSONProtocolConstants.TypeNames.NameI16),
- new Tuple<TType, byte[]>(TType.I32, TJSONProtocolConstants.TypeNames.NameI32),
- new Tuple<TType, byte[]>(TType.I64, TJSONProtocolConstants.TypeNames.NameI64),
- new Tuple<TType, byte[]>(TType.Double, TJSONProtocolConstants.TypeNames.NameDouble),
- new Tuple<TType, byte[]>(TType.String, TJSONProtocolConstants.TypeNames.NameString),
- new Tuple<TType, byte[]>(TType.Struct, TJSONProtocolConstants.TypeNames.NameStruct),
- new Tuple<TType, byte[]>(TType.Map, TJSONProtocolConstants.TypeNames.NameMap),
- new Tuple<TType, byte[]>(TType.Set, TJSONProtocolConstants.TypeNames.NameSet),
- new Tuple<TType, byte[]>(TType.List, TJSONProtocolConstants.TypeNames.NameList),
+ new(TType.Bool, TJSONProtocolConstants.TypeNames.NameBool),
+ new(TType.Byte, TJSONProtocolConstants.TypeNames.NameByte),
+ new(TType.I16, TJSONProtocolConstants.TypeNames.NameI16),
+ new(TType.I32, TJSONProtocolConstants.TypeNames.NameI32),
+ new(TType.I64, TJSONProtocolConstants.TypeNames.NameI64),
+ new(TType.Double, TJSONProtocolConstants.TypeNames.NameDouble),
+ new(TType.String, TJSONProtocolConstants.TypeNames.NameString),
+ new(TType.Struct, TJSONProtocolConstants.TypeNames.NameStruct),
+ new(TType.Map, TJSONProtocolConstants.TypeNames.NameMap),
+ new(TType.Set, TJSONProtocolConstants.TypeNames.NameSet),
+ new(TType.List, TJSONProtocolConstants.TypeNames.NameList),
};
foreach (var t in sets)
@@ -96,21 +96,21 @@
[ExpectedException(typeof(TProtocolException))]
public void GetTypeIdForTypeName_TStopTypeName_Test()
{
- TJSONProtocolHelper.GetTypeIdForTypeName(new []{(byte)TType.Stop, (byte)TType.Stop});
+ TJSONProtocolHelper.GetTypeIdForTypeName([(byte)TType.Stop, (byte)TType.Stop]);
}
[TestMethod]
[ExpectedException(typeof(TProtocolException))]
public void GetTypeIdForTypeName_NonExistingTypeName_Test()
{
- TJSONProtocolHelper.GetTypeIdForTypeName(new byte[]{100});
+ TJSONProtocolHelper.GetTypeIdForTypeName([100]);
}
[TestMethod]
[ExpectedException(typeof(TProtocolException))]
public void GetTypeIdForTypeName_EmptyName_Test()
{
- TJSONProtocolHelper.GetTypeIdForTypeName(new byte[] {});
+ TJSONProtocolHelper.GetTypeIdForTypeName([]);
}
[TestMethod]
@@ -169,4 +169,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolTests.cs b/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolTests.cs
index 4054a29..4f14ba7 100644
--- a/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolTests.cs
+++ b/lib/netstd/Tests/Thrift.Tests/Protocols/TJsonProtocolTests.cs
@@ -51,12 +51,8 @@
Assert.IsTrue(result.WrappedReader.GetType().Name.Equals("LookaheadReader", StringComparison.OrdinalIgnoreCase));
}
- private class TJSONProtocolWrapper : TJsonProtocol
+ private class TJSONProtocolWrapper(TTransport trans) : TJsonProtocol(trans)
{
- public TJSONProtocolWrapper(TTransport trans) : base(trans)
- {
- }
-
public object WrappedContext => Context;
public object WrappedReader => Reader;
public int WrappedRecursionDepth => RecursionDepth;
diff --git a/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj b/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj
index 94b7b09..54ce1e8 100644
--- a/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj
+++ b/lib/netstd/Tests/Thrift.Tests/Thrift.Tests.csproj
@@ -19,7 +19,8 @@
-->
<PropertyGroup>
- <TargetFramework>net7.0</TargetFramework>
+ <TargetFramework>net8.0</TargetFramework>
+ <LangVersion>latestMajor</LangVersion>
<Version>0.20.0.0</Version>
<Nullable>enable</Nullable>
</PropertyGroup>