Skip to content

Commit 8a17e47

Browse files
authored
Fix formatting issues (#386)
* fix format issues according to xunit 2.9.3 * adding REDIS_VERSION for test runners in IDE
1 parent 27ee1ad commit 8a17e47

25 files changed

+94
-82
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ FodyWeavers.xsd
382382
!.vscode/tasks.json
383383
!.vscode/launch.json
384384
!.vscode/extensions.json
385+
!.vscode/.runsettings
385386
*.code-workspace
386387

387388
# Local History for Visual Studio Code

.vscode/.runsettings

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- File name extension must be .runsettings -->
3+
<RunSettings>
4+
<RunConfiguration>
5+
<EnvironmentVariables>
6+
<!-- List of environment variables we want to set-->
7+
<REDIS_VERSION>7.4.0</REDIS_VERSION>
8+
</EnvironmentVariables>
9+
</RunConfiguration>
10+
</RunSettings>

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"dotnet-test-explorer.testArguments": "/p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info",
33
"dotnet-test-explorer.testProjectPath": "**/*NRedisStack.Tests.csproj",
4-
"dotnet.defaultSolution": "NRedisStack.sln"
4+
"dotnet.defaultSolution": "NRedisStack.sln",
5+
"dotnet.unitTests.runSettingsPath": ".vscode/.runsettings"
56
}

tests/NRedisStack.Tests/Bloom/BloomTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public void TestInfo(string endpointId)
239239
var info = bf.Info(key);
240240

241241
Assert.NotNull(info);
242-
Assert.Equal(info.NumberOfItemsInserted, (long)1);
242+
Assert.Equal((long)1, info.NumberOfItemsInserted);
243243

244244
Assert.Throws<RedisServerException>(() => bf.Info("notExistKey"));
245245
}
@@ -255,7 +255,7 @@ public async Task TestInfoAsync(string endpointId)
255255
var info = await bf.InfoAsync(key);
256256

257257
Assert.NotNull(info);
258-
Assert.Equal(info.NumberOfItemsInserted, (long)1);
258+
Assert.Equal((long)1, info.NumberOfItemsInserted);
259259

260260
await Assert.ThrowsAsync<RedisServerException>(() => bf.InfoAsync("notExistKey"));
261261
}

tests/NRedisStack.Tests/CuckooFilter/CuckooTests.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,14 @@ public void TestInfo(string endpointId)
192192
var info = cf.Info(key);
193193

194194
Assert.NotNull(info);
195-
Assert.Equal(info.BucketSize, (long)2);
196-
Assert.Equal(info.ExpansionRate, (long)1);
197-
Assert.Equal(info.MaxIterations, (long)20);
198-
Assert.Equal(info.NumberOfBuckets, (long)512);
199-
Assert.Equal(info.NumberOfFilters, (long)1);
200-
Assert.Equal(info.NumberOfItemsDeleted, (long)0);
201-
Assert.Equal(info.NumberOfItemsInserted, (long)1);
202-
Assert.Equal(info.Size, (long)1080);
195+
Assert.Equal((long)2, info.BucketSize);
196+
Assert.Equal((long)1, info.ExpansionRate);
197+
Assert.Equal((long)20, info.MaxIterations);
198+
Assert.Equal((long)512, info.NumberOfBuckets);
199+
Assert.Equal((long)1, info.NumberOfFilters);
200+
Assert.Equal((long)0, info.NumberOfItemsDeleted);
201+
Assert.Equal((long)1, info.NumberOfItemsInserted);
202+
Assert.Equal((long)1080, info.Size);
203203

204204
Assert.Throws<RedisServerException>(() => cf.Info("notExistKey"));
205205
}
@@ -215,14 +215,14 @@ public async Task TestInfoAsync(string endpointId)
215215
var info = await cf.InfoAsync(key);
216216

217217
Assert.NotNull(info);
218-
Assert.Equal(info.BucketSize, (long)2);
219-
Assert.Equal(info.ExpansionRate, (long)1);
220-
Assert.Equal(info.MaxIterations, (long)20);
221-
Assert.Equal(info.NumberOfBuckets, (long)512);
222-
Assert.Equal(info.NumberOfFilters, (long)1);
223-
Assert.Equal(info.NumberOfItemsDeleted, (long)0);
224-
Assert.Equal(info.NumberOfItemsInserted, (long)1);
225-
Assert.Equal(info.Size, (long)1080);
218+
Assert.Equal((long)2, info.BucketSize);
219+
Assert.Equal((long)1, info.ExpansionRate);
220+
Assert.Equal((long)20, info.MaxIterations);
221+
Assert.Equal((long)512, info.NumberOfBuckets);
222+
Assert.Equal((long)1, info.NumberOfFilters);
223+
Assert.Equal((long)0, info.NumberOfItemsDeleted);
224+
Assert.Equal((long)1, info.NumberOfItemsInserted);
225+
Assert.Equal((long)1080, info.Size);
226226

227227

228228

tests/NRedisStack.Tests/Examples/ExampleTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public async Task PipelineWithAsync(string endpointId)
225225
selectedLabels: new List<string> { "location" });
226226

227227
// Assert the response
228-
Assert.Equal(1, response.Count);
228+
Assert.Single(response);
229229
Assert.Equal("temp:JLM", response[0].key);
230230
}
231231

tests/NRedisStack.Tests/Json/JsonTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ public void TestMultiPathGet(string endpointId)
990990
}
991991
else
992992
{
993-
Assert.True(false, "$..a was not a json array");
993+
Assert.Fail("$..a was not a json array");
994994
}
995995

996996
Assert.True(obj["$.b"]![0]!["a"]!.ToString() == "world");
@@ -1015,7 +1015,7 @@ public async Task TestMultiPathGetAsync(string endpointId)
10151015
}
10161016
else
10171017
{
1018-
Assert.True(false, "$..a was not a json array");
1018+
Assert.Fail("$..a was not a json array");
10191019
}
10201020

10211021
Assert.True(obj["$.b"]![0]!["a"]!.ToString() == "world");

tests/NRedisStack.Tests/Search/SearchTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2170,7 +2170,7 @@ public void TestLimit(string endpointId)
21702170
var req = new AggregationRequest("*").SortBy("@t1").Limit(1);
21712171
var res = ft.Aggregate("idx", req);
21722172

2173-
Assert.Equal(1, res.GetResults().Count);
2173+
Assert.Single(res.GetResults());
21742174
Assert.Equal("a", res.GetResults()[0]["t1"].ToString());
21752175
}
21762176

@@ -2190,7 +2190,7 @@ public async Task TestLimitAsync(string endpointId)
21902190
var req = new AggregationRequest("*").SortBy("@t1").Limit(1, 1);
21912191
var res = await ft.AggregateAsync("idx", req);
21922192

2193-
Assert.Equal(1, res.GetResults().Count);
2193+
Assert.Single(res.GetResults());
21942194
Assert.Equal("b", res.GetResults()[0]["t1"].ToString());
21952195
}
21962196

tests/NRedisStack.Tests/TimeSeries/TestAPI/TestAdd.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ public void TestAddAndIgnoreValues(string endpointId)
228228
RedisResult info = TimeSeriesHelper.getInfo(db, key, out j, out k);
229229
Assert.NotNull(info);
230230
Assert.True(info.Length > 0);
231-
Assert.NotEqual(j, -1);
232-
Assert.NotEqual(k, -1);
231+
Assert.NotEqual(-1, j);
232+
Assert.NotEqual(-1, k);
233233
Assert.Equal(15, (long)info[j + 1]);
234234
Assert.Equal(16, (long)info[k + 1]);
235235
}

tests/NRedisStack.Tests/TimeSeries/TestAPI/TestAlter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ public void TestAlterAndIgnoreValues(string endpointId)
7373
RedisResult info = TimeSeriesHelper.getInfo(db, key, out j, out k);
7474
Assert.NotNull(info);
7575
Assert.True(info.Length > 0);
76-
Assert.NotEqual(j, -1);
77-
Assert.NotEqual(k, -1);
76+
Assert.NotEqual(-1, j);
77+
Assert.NotEqual(-1, k);
7878
Assert.Equal(13, (long)info[j + 1]);
7979
Assert.Equal(14, (long)info[k + 1]);
8080
}

0 commit comments

Comments
 (0)