public void ShouldOverWriteFile() { var test = new TestClasse { PropertyOne = "test", PropertyTwo = 1, }; using (var store = new SerializationStorage<TestClasse>()) { store.Add(test); store.Add(test); store.Add(test); store.Add(test); } var test2 = new TestClasse { PropertyOne = "test2", PropertyTwo = 2, }; using (var store = new SerializationStorage<TestClasse>()) { store.Clear(); store.Add(test2); } using (var store = new SerializationStorage<TestClasse>()) { Assert.IsTrue(store.Last().PropertyTwo == 2); } }
public void CreateStorageTest() { var test = new TestClasse { PropertyOne = "test", PropertyTwo = 1, }; var store = new SerializationStorage<TestClasse> {test}; Assert.IsTrue(store.Any()); }
public void CleanStorageTest() { var test = new TestClasse { PropertyOne = "test", PropertyTwo = 1, }; using (var store = new SerializationStorage<TestClasse>()) { store.Add(test); } using (var store = new SerializationStorage<TestClasse>()) { store.Clear(); } using (var store = new SerializationStorage<TestClasse>()) { Assert.IsFalse(store.Any()); } }
public void TestWriteTwice() { var test = new TestClasse { PropertyOne = "test", PropertyTwo = 1, }; using (var store = new SerializationStorage<TestClasse>()) { store.Add(test); } using (var store = new SerializationStorage<TestClasse>()) { Assert.IsTrue(store.Last().PropertyOne == "test"); store.Last().PropertyTwo = 2; } using (var store = new SerializationStorage<TestClasse>()) { Assert.IsTrue(store.Last().PropertyTwo == 2); } }