Reformat/cleanup
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m10s
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m10s
This commit is contained in:
@@ -8,7 +8,7 @@ public class RecursiveNodeMergeConflictResolverTests
|
||||
private readonly RecursiveNodeMergeConflictResolver _resolver;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RecursiveNodeMergeConflictResolverTests"/> class.
|
||||
/// Initializes a new instance of the <see cref="RecursiveNodeMergeConflictResolverTests" /> class.
|
||||
/// </summary>
|
||||
public RecursiveNodeMergeConflictResolverTests()
|
||||
{
|
||||
@@ -17,20 +17,20 @@ public class RecursiveNodeMergeConflictResolverTests
|
||||
|
||||
private Document CreateDoc(string key, object data, HlcTimestamp ts)
|
||||
{
|
||||
var json = JsonSerializer.Serialize(data);
|
||||
string json = JsonSerializer.Serialize(data);
|
||||
var element = JsonDocument.Parse(json).RootElement;
|
||||
return new Document("test", key, element, ts, false);
|
||||
}
|
||||
|
||||
private OplogEntry CreateOp(string key, object data, HlcTimestamp ts)
|
||||
{
|
||||
var json = JsonSerializer.Serialize(data);
|
||||
string json = JsonSerializer.Serialize(data);
|
||||
var element = JsonDocument.Parse(json).RootElement;
|
||||
return new OplogEntry("test", key, OperationType.Put, element, ts, string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that disjoint fields are merged into a single document.
|
||||
/// Verifies that disjoint fields are merged into a single document.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Resolve_ShouldMergeDisjointFields()
|
||||
@@ -56,7 +56,7 @@ public class RecursiveNodeMergeConflictResolverTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that primitive collisions are resolved using the higher timestamp value.
|
||||
/// Verifies that primitive collisions are resolved using the higher timestamp value.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Resolve_ShouldPrioritizeHigherTimestamp_PrimitiveCollision()
|
||||
@@ -81,7 +81,7 @@ public class RecursiveNodeMergeConflictResolverTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that nested object content is merged recursively.
|
||||
/// Verifies that nested object content is merged recursively.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Resolve_ShouldRecursivelyMergeObjects()
|
||||
@@ -104,7 +104,7 @@ public class RecursiveNodeMergeConflictResolverTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that arrays containing object identifiers are merged by item identity.
|
||||
/// Verifies that arrays containing object identifiers are merged by item identity.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Resolve_ShouldMergeArraysById()
|
||||
@@ -115,7 +115,8 @@ public class RecursiveNodeMergeConflictResolverTests
|
||||
|
||||
var doc = CreateDoc("k1", new
|
||||
{
|
||||
items = new[] {
|
||||
items = new[]
|
||||
{
|
||||
new { id = "1", val = "A" },
|
||||
new { id = "2", val = "B" }
|
||||
}
|
||||
@@ -123,9 +124,10 @@ public class RecursiveNodeMergeConflictResolverTests
|
||||
|
||||
var op = CreateOp("k1", new
|
||||
{
|
||||
items = new[] {
|
||||
items = new[]
|
||||
{
|
||||
new { id = "1", val = "A-Updated" }, // Update
|
||||
new { id = "3", val = "C" } // Insert
|
||||
new { id = "3", val = "C" } // Insert
|
||||
}
|
||||
}, ts2);
|
||||
|
||||
@@ -133,14 +135,14 @@ public class RecursiveNodeMergeConflictResolverTests
|
||||
var result = _resolver.Resolve(doc, op);
|
||||
|
||||
// Assert
|
||||
Action<JsonElement> validate = (root) =>
|
||||
Action<JsonElement> validate = root =>
|
||||
{
|
||||
var items = root.GetProperty("items");
|
||||
items.GetArrayLength().ShouldBe(3);
|
||||
|
||||
// Order is not guaranteed, so find by id
|
||||
// But simplified test checking content exists
|
||||
var text = items.GetRawText();
|
||||
string text = items.GetRawText();
|
||||
text.ShouldContain("A-Updated");
|
||||
text.ShouldContain("B");
|
||||
text.ShouldContain("C");
|
||||
@@ -150,7 +152,7 @@ public class RecursiveNodeMergeConflictResolverTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that primitive arrays fall back to last-write-wins behavior.
|
||||
/// Verifies that primitive arrays fall back to last-write-wins behavior.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Resolve_ShouldFallbackToLWW_ForPrimitiveArrays()
|
||||
@@ -170,4 +172,4 @@ public class RecursiveNodeMergeConflictResolverTests
|
||||
tags.GetArrayLength().ShouldBe(1);
|
||||
tags[0].GetString().ShouldBe("c");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user