Skip to content

Commit

Permalink
Test matching Core category names.
Browse files Browse the repository at this point in the history
  • Loading branch information
elle-j committed Jul 1, 2024
1 parent 9557420 commit 9d41867
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Tests/Realm.Tests/Database/LoggerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,20 @@ public void Logger_CallsCustomFunction()
AssertLogMessageContains(messages[0], LogLevel.Warn, LogCategory.Realm.SDK, "A log message");
}

// TODO(lj): Test that all Core categories are being used and matches names.
[Test]
public void Logger_MatchesCoreCategoryNames()
{
var coreCategoryNames = SharedRealmHandle.GetLogCategoryNames();
var sdkCategoriesMap = LogCategory.NameToCategory;

Assert.That(sdkCategoriesMap.Count, Is.EqualTo(coreCategoryNames.Length));
foreach (var name in coreCategoryNames)
{
Assert.That(sdkCategoriesMap.TryGetValue(name!, out var category), Is.True);
Assert.That(category!.Name, Is.EqualTo(name));
Assert.That(LogCategory.FromName(name!), Is.SameAs(category));
}
}

[Test]
public void FileLogger()
Expand Down

0 comments on commit 9d41867

Please sign in to comment.