Skip to content

Commit 6e83758

Browse files
committed
tests passing for #23
1 parent 5006760 commit 6e83758

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

Assets/Tests/DeltaContainerTest.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,28 @@ public void ListenReplace() {
7373
}
7474
});
7575

76-
container.Set (new IndexedDictionary<string, object>(newData));
76+
container.Set (newData);
7777
Assert.AreEqual (2, listenCalls);
7878
}
7979

80+
[Test]
81+
public void ListenWithoutPlaceholder() {
82+
var newData = GetRawData ();
83+
84+
var game = (IndexedDictionary<string, object>) newData ["game"];
85+
game ["turn"] = 1;
86+
87+
var listenCalls = 0;
88+
container.Listen ("game/turn", (DataChange change) => {
89+
listenCalls++;
90+
Assert.AreEqual(change.operation, "replace");
91+
Assert.AreEqual(change.value, 1);
92+
});
93+
94+
container.Set (newData);
95+
Assert.AreEqual (1, listenCalls);
96+
}
97+
8098
[Test]
8199
public void ListenAddArray() {
82100
var newData = GetRawData ();
@@ -130,6 +148,9 @@ protected IndexedDictionary<string, object> GetRawData () {
130148
})}
131149
}));
132150

151+
data.Add ("game", new IndexedDictionary<string, object>(new Dictionary<string, object> {
152+
{"turn", 0}
153+
}));
133154
data.Add ("players", players);
134155
data.Add ("messages", new List<object> { "one", "two", "three" });
135156
return data;

0 commit comments

Comments
 (0)