Skip to content

Commit f08f47d

Browse files
committed
add failing test when replacing a string on state. #30
1 parent 59a75e5 commit f08f47d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Assets/Tests/DeltaContainerTest.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,22 @@ public void ListenReplace() {
7777
Assert.AreEqual (2, listenCalls);
7878
}
7979

80+
[Test]
81+
public void ListenReplaceString() {
82+
var newData = GetRawData ();
83+
newData ["turn"] = "mutated";
84+
85+
var listenCalls = 0;
86+
container.Listen ("turn", (DataChange change) => {
87+
listenCalls++;
88+
Assert.AreEqual(change.value, "mutated");
89+
});
90+
91+
container.Set (newData);
92+
Assert.AreEqual (1, listenCalls);
93+
}
94+
95+
8096
[Test]
8197
public void ListenWithoutPlaceholder() {
8298
var newData = GetRawData ();
@@ -152,6 +168,7 @@ protected IndexedDictionary<string, object> GetRawData () {
152168
{"turn", 0}
153169
}));
154170
data.Add ("players", players);
171+
data.Add ("turn", "none");
155172
data.Add ("messages", new List<object> { "one", "two", "three" });
156173
return data;
157174
}

0 commit comments

Comments
 (0)