public void TestUnsuccessfulLoadFile() { IFactory factory = new TestingFactory(PASSWORD, IV, SALT); ActionList actionList = factory.GetActionList(); IStorage storage = factory.GetStorage(); AccountCollection collection = TestObjectBuilder.GetAccountCollection(); string serialized = actionList.DoActions(collection); storage.StoreData("test", serialized); string fromStorage = storage.RetrieveData("test"); IFactory factory2 = new TestingFactory("wrong", IV, SALT); ActionList actionList2 = factory2.GetActionList(); try { AccountCollection deserialized = actionList2.ReverseActions <AccountCollection>(fromStorage); } catch (DeserializationException) { // Success return; } Assert.Fail("Exception should have been thrown because wrong password was used."); }
public void TestHashCodeInequality() { AccountCollection accountCol1 = TestObjectBuilder.GetAccountCollection(); AccountCollection accountCol2 = TestObjectBuilder.GetAccountCollection2(); Assert.AreNotEqual(accountCol1.GetHashCode(), accountCol2.GetHashCode()); }
public void TestInequality() { AccountCollection accountCol1 = TestObjectBuilder.GetAccountCollection(); AccountCollection accountCol2 = TestObjectBuilder.GetAccountCollection2(); Assert.AreNotEqual(accountCol1, accountCol2); }
public void TestEqualityWithNoAccounts() { AccountCollection coll1 = TestObjectBuilder.GetAccountCollectionWithNoAccounts(); AccountCollection coll2 = TestObjectBuilder.GetAccountCollection(); try { bool isEqual = coll1.Equals(coll2); isEqual = coll2.Equals(coll1); } catch (Exception ex) { Assert.Fail("An exception was thrown when checking equality with a collection with no accounts: " + ex.ToString()); } }
public void TestSerializeAndDeserialize() { IFactory factory = new TestingFactory(PASSWORD, IV, SALT); ActionList actionList = factory.GetActionList(); IStorage storage = factory.GetStorage(); AccountCollection collection = TestObjectBuilder.GetAccountCollection(); string serialized = actionList.DoActions(collection); storage.StoreData("test", serialized); string fromStorage = storage.RetrieveData("test"); AccountCollection deserialized = actionList.ReverseActions <AccountCollection>(fromStorage); Assert.AreEqual(collection, deserialized); }