Example #1
0
        public void TestHashCodeInequality()
        {
            Account account1 = TestObjectBuilder.GetAccount1();
            Account account2 = TestObjectBuilder.GetAccount2();

            Assert.AreNotEqual(account1.GetHashCode(), account2.GetHashCode());
        }
Example #2
0
        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.");
        }
Example #3
0
        public void TestInequality()
        {
            Account account1 = TestObjectBuilder.GetAccount1();
            Account account2 = TestObjectBuilder.GetAccount2();

            Assert.AreNotEqual(account1, account2);
        }
Example #4
0
        public void TestHashCodeInequality()
        {
            AccountCollection accountCol1 = TestObjectBuilder.GetAccountCollection();
            AccountCollection accountCol2 = TestObjectBuilder.GetAccountCollection2();

            Assert.AreNotEqual(accountCol1.GetHashCode(), accountCol2.GetHashCode());
        }
Example #5
0
        public void TestInequality()
        {
            AccountCollection accountCol1 = TestObjectBuilder.GetAccountCollection();
            AccountCollection accountCol2 = TestObjectBuilder.GetAccountCollection2();

            Assert.AreNotEqual(accountCol1, accountCol2);
        }
Example #6
0
        public void TestHashCodeInequality()
        {
            Credential cred1 = TestObjectBuilder.GetCredential1();
            Credential cred2 = TestObjectBuilder.GetCredential2();

            Assert.AreNotEqual(cred1.GetHashCode(), cred2.GetHashCode());
        }
Example #7
0
        public void TestInequality()
        {
            Credential cred1 = TestObjectBuilder.GetCredential1();
            Credential cred2 = TestObjectBuilder.GetCredential2();

            Assert.AreNotEqual(cred1, cred2);
        }
Example #8
0
 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());
     }
 }
Example #9
0
        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());
            }
        }
Example #10
0
        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());
            }
        }
Example #11
0
        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());
            }
        }
Example #12
0
        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());
            }
        }
Example #13
0
        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());
            }
        }
Example #14
0
        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);
        }