THRIFT-5020 Refactoring & minor fixes for netstd library
Client: netstd
Patch: Jens Geyer
This closes #1941
diff --git a/test/netstd/Client/TestClient.cs b/test/netstd/Client/TestClient.cs
index 0f58f95..13ae313 100644
--- a/test/netstd/Client/TestClient.cs
+++ b/test/netstd/Client/TestClient.cs
@@ -448,7 +448,7 @@
public static byte[] PrepareTestData(bool randomDist, BinaryTestSize testcase)
{
- int amount = -1;
+ int amount;
switch (testcase)
{
case BinaryTestSize.Empty:
@@ -622,26 +622,29 @@
{
Console.WriteLine("*** FAILED ***");
returnCode |= ErrorContainers;
- throw new Exception("CrazyNesting.Equals failed");
}
}
// TODO: Validate received message
Console.Write("testStruct({\"Zero\", 1, -3, -5})");
- var o = new Xtruct();
- o.String_thing = "Zero";
- o.Byte_thing = (sbyte)1;
- o.I32_thing = -3;
- o.I64_thing = -5;
+ var o = new Xtruct
+ {
+ String_thing = "Zero",
+ Byte_thing = (sbyte)1,
+ I32_thing = -3,
+ I64_thing = -5
+ };
var i = await client.testStructAsync(o, MakeTimeoutToken());
Console.WriteLine(" = {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}");
// TODO: Validate received message
Console.Write("testNest({1, {\"Zero\", 1, -3, -5}, 5})");
- var o2 = new Xtruct2();
- o2.Byte_thing = (sbyte)1;
- o2.Struct_thing = o;
- o2.I32_thing = 5;
+ var o2 = new Xtruct2
+ {
+ Byte_thing = (sbyte)1,
+ Struct_thing = o,
+ I32_thing = 5
+ };
var i2 = await client.testNestAsync(o2, MakeTimeoutToken());
i = i2.Struct_thing;
Console.WriteLine(" = {" + i2.Byte_thing + ", {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}, " + i2.I32_thing + "}");
@@ -838,16 +841,24 @@
Console.WriteLine("}");
// TODO: Validate received message
- var insane = new Insanity();
- insane.UserMap = new Dictionary<Numberz, long>();
- insane.UserMap[Numberz.FIVE] = 5000L;
- var truck = new Xtruct();
- truck.String_thing = "Truck";
- truck.Byte_thing = (sbyte)8;
- truck.I32_thing = 8;
- truck.I64_thing = 8;
- insane.Xtructs = new List<Xtruct>();
- insane.Xtructs.Add(truck);
+ var insane = new Insanity
+ {
+ UserMap = new Dictionary<Numberz, long>
+ {
+ [Numberz.FIVE] = 5000L
+ }
+ };
+ var truck = new Xtruct
+ {
+ String_thing = "Truck",
+ Byte_thing = (sbyte)8,
+ I32_thing = 8,
+ I64_thing = 8
+ };
+ insane.Xtructs = new List<Xtruct>
+ {
+ truck
+ };
Console.Write("testInsanity()");
var whoa = await client.testInsanityAsync(insane, MakeTimeoutToken());
Console.Write(" = {");
@@ -902,8 +913,10 @@
sbyte arg0 = 1;
var arg1 = 2;
var arg2 = long.MaxValue;
- var multiDict = new Dictionary<short, string>();
- multiDict[1] = "one";
+ var multiDict = new Dictionary<short, string>
+ {
+ [1] = "one"
+ };
var tmpMultiDict = new List<string>();
foreach (var pair in multiDict)