public void TestHashCodeInequality() { Account account1 = TestObjectBuilder.GetAccount1(); Account account2 = TestObjectBuilder.GetAccount2(); Assert.AreNotEqual(account1.GetHashCode(), account2.GetHashCode()); }
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 TestInequality() { Account account1 = TestObjectBuilder.GetAccount1(); Account account2 = TestObjectBuilder.GetAccount2(); Assert.AreNotEqual(account1, account2); }
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 TestHashCodeInequality() { Credential cred1 = TestObjectBuilder.GetCredential1(); Credential cred2 = TestObjectBuilder.GetCredential2(); Assert.AreNotEqual(cred1.GetHashCode(), cred2.GetHashCode()); }
public void TestInequality() { Credential cred1 = TestObjectBuilder.GetCredential1(); Credential cred2 = TestObjectBuilder.GetCredential2(); Assert.AreNotEqual(cred1, cred2); }
public void TestGetHashCodeWithNullProperties() { try { Credential cred = TestObjectBuilder.GetCredentialWithNullProperties(); int hashCode = cred.GetHashCode(); } catch (Exception ex) { Assert.Fail("An exception was thrown when generating a hash code: " + ex.ToString()); } }
public void TestGetHashCodeWithNullProperties() { Account account = TestObjectBuilder.GetAccountWithNullProperties(); try { int hashCode = account.GetHashCode(); } catch (Exception ex) { Assert.Fail("An exception was thrown when generating a hash code: " + ex.ToString()); } }
public void TestGetHashCodeWithNoAccounts() { AccountCollection collection = TestObjectBuilder.GetAccountCollectionWithNoAccounts(); try { int hashCode = collection.GetHashCode(); } catch (Exception ex) { Assert.Fail("There was an exception when generating a hash code for a collection with no accounts: " + ex.ToString()); } }
public void TestEqualityWithNullProperties() { Account account1 = TestObjectBuilder.GetAccountWithNullProperties(); Account account2 = TestObjectBuilder.GetAccount1(); try { bool isEqual = account1.Equals(account2); isEqual = account2.Equals(account1); } catch (Exception ex) { Assert.Fail("An exception was thrown when testing equality: " + ex.ToString()); } }
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 TestEqualityCheckWithNullProperties() { Credential cred1 = TestObjectBuilder.GetCredentialWithNullProperties(); Credential cred2 = TestObjectBuilder.GetCredential1(); try { bool isEqual = cred1.Equals(cred2); isEqual = cred2.Equals(cred1); } catch (Exception ex) { Assert.Fail("An exception was thrown when testing equality: " + 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); }