public void TestAdd() { serverSyncSet.Add("yay"); Assert.That(serverSyncSet.IsDirty, Is.True); SerializeDeltaTo(serverSyncSet, clientSyncSet); Assert.That(clientSyncSet, Is.EquivalentTo(new[] { "Hello", "World", "!", "yay" })); Assert.That(serverSyncSet.IsDirty, Is.False); }
public void SetUp() { serverSyncSet = new SyncSetString(); clientSyncSet = new SyncSetString(); // add some data to the list serverSyncSet.Add("Hello"); serverSyncSet.Add("World"); serverSyncSet.Add("!"); SerializeAllTo(serverSyncSet, clientSyncSet); }
public void ObjectCanBeReusedAfterReset() { clientSyncSet.Reset(); // make old client the host SyncSetString hostList = clientSyncSet; SyncSetString clientList2 = new SyncSetString(); Assert.That(hostList.IsReadOnly, Is.False); // Check Add and Sync without errors hostList.Add("1"); hostList.Add("2"); hostList.Add("3"); SerializeDeltaTo(hostList, clientList2); }
public void ReadonlyTest() { SyncSetString serverList = new SyncSetString(); SyncSetString clientList = new SyncSetString(); // data has been flushed, should go back to clear Assert.That(clientList.IsReadOnly, Is.False); serverList.Add("1"); serverList.Add("2"); serverList.Add("3"); SerializeDeltaTo(serverList, clientList); // client list should now lock itself, trying to modify it // should produce an InvalidOperationException Assert.That(clientList.IsReadOnly, Is.True); Assert.Throws <InvalidOperationException>(() => { clientList.Add("5"); }); }
public void WritingToReadOnlyThrows() { Assert.Throws <InvalidOperationException>(() => { clientSyncSet.Add("5"); }); }