public void StartWithItemsInBothButPrimaryNewer_NewestOneWins() { PalasoTestItem item = _secondary.CreateItem(); item.StoredString = "item one"; _secondary.SaveItem(item); item = _primary.CreateItem(); item.StoredString = "item two"; _primary.SaveItem(item); _synchronic.Dispose(); _synchronic = new SynchronicRepository <PalasoTestItem>(_primary, _secondary); Assert.AreEqual(1, _primary.CountAllItems()); Assert.AreEqual(1, _secondary.CountAllItems()); Assert.AreEqual("item two", _primary.GetItem(_primary.GetAllItems()[0]).StoredString); Assert.AreEqual("item two", _secondary.GetItem(_secondary.GetAllItems()[0]).StoredString); }
public void StartWithItemsInSecondary_ItemsCopiedToPrimary() { PalasoTestItem item = _secondary.CreateItem(); item.StoredString = "item one"; item = _secondary.CreateItem(); item.StoredString = "item two"; _synchronic.Dispose(); _synchronic = new SynchronicRepository <PalasoTestItem>(_primary, _secondary); Assert.AreEqual(2, _primary.CountAllItems()); var strings = new List <string>(2) { _primary.GetItem(_primary.GetAllItems()[0]).StoredString, _primary.GetItem(_primary.GetAllItems()[1]).StoredString }; Assert.Contains("item one", strings); Assert.Contains("item two", strings); }
public override void SetUp() { DataMapperUnderTest = new SynchronicRepository <PalasoTestItem>(new MemoryDataMapper <PalasoTestItem>(), new MemoryDataMapper <PalasoTestItem>()); }
public void Setup() { _primary = new MemoryDataMapper <PalasoTestItem>(); _secondary = new MemoryDataMapper <PalasoTestItem>(); _synchronic = new SynchronicRepository <PalasoTestItem>(_primary, _secondary); }