Skip to content

Commit

Permalink
Fix a warning and Unity build (#3663)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirinchev authored Aug 23, 2024
1 parent b73263e commit 7c1327e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Realm/Realm/Logging/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

using System;
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
Expand Down Expand Up @@ -49,6 +50,7 @@ protected override void LogImpl(LogLevel level, LogCategory category, string mes
/// A few built-in implementations are provided by <see cref="Console"/>, <see cref="Null"/>, and <see cref="Function(Action{string})"/>,
/// but you can implement your own.
/// </summary>
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "Original logger is deprecated")]
public abstract class RealmLogger
{
private readonly Lazy<GCHandle> _gcHandle;
Expand Down
5 changes: 3 additions & 2 deletions Tests/Realm.Tests/Sync/DataTypeSynchronizationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -902,14 +902,15 @@ public void NestedCollections_Merge()
var list2 = obj1.RealmValueProperty.AsDictionary()["list"].AsList();
var dictionary2 = obj1.RealmValueProperty.AsDictionary()["dictionary"].AsDictionary();

Assert.That(list1, Does.Not.Contain((RealmValue)1));
Assert.That(list1, Does.Not.Contains((RealmValue)1));
Assert.That(list1, Contains.Item((RealmValue)2));
Assert.That(list1, Contains.Item((RealmValue)3));
Assert.That(list1, Contains.Item((RealmValue)4));
Assert.That(list1, Contains.Item((RealmValue)5));
Assert.That(list1, Is.EqualTo(list2).Using(_rvComparer));

Assert.That(dictionary1, Does.Not.ContainKey("key1"));
// Unity Nunit doesn't support Does.Not.ContainKey, so use a more simplistic expression here
Assert.That(dictionary1.ContainsKey("key1"), Is.False);
Assert.That(dictionary1, Contains.Key("key2"));
Assert.That(dictionary1, Contains.Key("key3"));
Assert.That(dictionary1, Is.EqualTo(dictionary2).Using(_rvComparer));
Expand Down
2 changes: 1 addition & 1 deletion Tests/Realm.Tests/Sync/SynchronizedInstanceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ public void SyncLogger_WhenLevelChanges_LogsAtNewLevel()
}

var regex = new Regex("Connection\\[\\d+] Session\\[\\d+]");
var logger = RealmLogger.Function((level, msg) =>
var logger = RealmLogger.Function((level, _, msg) =>
{
if (regex.IsMatch(msg))
{
Expand Down

0 comments on commit 7c1327e

Please sign in to comment.