Skip to content

Commit 287de60

Browse files
Fixed unit test errors when nulls are returned
1 parent cf89b17 commit 287de60

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

TestWasm/Pages/Home.razor

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@
137137
private void RunTest<T>(string testName,
138138
IEnumerable<T> indexDbResults, IEnumerable<T> correctResults) where T : class
139139
{
140+
// Remove any nulls from both collections
141+
indexDbResults = indexDbResults.Where(x => x != null);
142+
correctResults = correctResults.Where(x => x != null);
143+
140144
var result = TestValidator.ValidateLists(correctResults, indexDbResults);
141145

142146
string countResults = $"Results: {indexDbResults.Count()}";
@@ -258,7 +262,7 @@
258262

259263
allPeople = await personQuery.ToListAsync();
260264

261-
265+
262266

263267
List<Person> people = await personQuery.ToListAsync();
264268
StateHasChanged();
@@ -509,6 +513,8 @@
509513

510514
var asdffffff = await personQuery.FirstOrDefaultAsync(x => x.Name == "asdfn3nxknnd");
511515

516+
var sdfsdfsdfdfsdf = await personQuery.OrderBy(x => x._Age).FirstOrDefaultAsync();
517+
512518
// RunTest("null first or default", new List<Person>() { await personQuery.FirstOrDefaultAsync(x => x.Name == "asdfn3nxknnd") },
513519
// new List<Person>() { allPeople.OrderBy(x => x._Age).ThenBy(x => x._Id).FirstOrDefault(x => x.Name == "asdfn3nxknnd") });
514520

0 commit comments

Comments
 (0)