Use var for local variables in test cases

Updated all instances of explicitly typed `string` and `JsonElement` to `var` in `JsonElementConverterTests.cs` to improve code readability and maintain consistency with modern C# coding practices. This change does not affect functionality but aligns with better style conventions.
This commit is contained in:
Sipke Schoorstra 2025-01-14 23:19:51 +01:00
parent 9842a0dd7b
commit cc694bf15b

View file

@ -23,8 +23,8 @@ public class JsonElementConverterTests(ITestOutputHelper testOutputHelper)
Name = "JsonVariable"
};
string jsonString = "{\"name\": \"John\", \"age\": 30}";
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(jsonString);
var jsonString = "{\"name\": \"John\", \"age\": 30}";
var jsonElement = JsonSerializer.Deserialize<JsonElement>(jsonString);
jsonVariable.Set(expressionExecutionContext, jsonElement);
var script = "getVariable('JsonVariable').age";
@ -42,8 +42,8 @@ public class JsonElementConverterTests(ITestOutputHelper testOutputHelper)
Name = "JsonVariable"
};
string jsonString = "[1, 2, 3, 4, 5, 6]";
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(jsonString);
var jsonString = "[1, 2, 3, 4, 5, 6]";
var jsonElement = JsonSerializer.Deserialize<JsonElement>(jsonString);
jsonVariable.Set(expressionExecutionContext, jsonElement);
var script = "getVariable('JsonVariable')[3]";
@ -61,8 +61,8 @@ public class JsonElementConverterTests(ITestOutputHelper testOutputHelper)
Name = "JsonVariable"
};
string jsonString = "\"I'm just a string\"";
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(jsonString);
var jsonString = "\"I'm just a string\"";
var jsonElement = JsonSerializer.Deserialize<JsonElement>(jsonString);
jsonVariable.Set(expressionExecutionContext, jsonElement);
var script = "getVariable('JsonVariable')";
@ -80,8 +80,8 @@ public class JsonElementConverterTests(ITestOutputHelper testOutputHelper)
Name = "JsonVariable"
};
string jsonString = "false";
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(jsonString);
var jsonString = "false";
var jsonElement = JsonSerializer.Deserialize<JsonElement>(jsonString);
jsonVariable.Set(expressionExecutionContext, jsonElement);
var script = "getVariable('JsonVariable')";
@ -99,7 +99,7 @@ public class JsonElementConverterTests(ITestOutputHelper testOutputHelper)
Name = "JsonVariable"
};
string jsonString = @"
var jsonString = @"
{
""name"": ""John Doe"",
""age"": 35,
@ -128,7 +128,7 @@ public class JsonElementConverterTests(ITestOutputHelper testOutputHelper)
""isEmployed"": true,
""contact"": { ""email"": ""john.doe@example.com"", ""phone"": ""555-1234"" }
}";
JsonElement jsonElement = JsonSerializer.Deserialize<JsonElement>(jsonString);
var jsonElement = JsonSerializer.Deserialize<JsonElement>(jsonString);
jsonVariable.Set(expressionExecutionContext, jsonElement);