예제 #1
0
        public void MoneyBagEquals()

        {
            //NOTE: Normally we use Assert.AreEqual to test whether two

            // objects are equal. But here we are testing the MoneyBag.Equals()

            // method itself, so using AreEqual would not serve the purpose.

            Assert.IsFalse(fMB1.Equals(null));



            Assert.IsTrue(fMB1.Equals(fMB1));

            MoneyBag equal = new MoneyBag(new Money(12, "CHF"), new Money(7, "USD"));

            Assert.IsTrue(fMB1.Equals(equal));

            Assert.IsTrue(!fMB1.Equals(f12CHF));

            Assert.IsTrue(!f12CHF.Equals(fMB1));

            Assert.IsTrue(!fMB1.Equals(fMB2));
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        public void TestMoneyBagEquals()
        {
            Assertion.Assert(!fMB1.Equals(null));

            Assertion.AssertEquals(fMB1, fMB1);
            MoneyBag equal = new MoneyBag(new Money(12, "CHF"), new Money(7, "USD"));

            Assertion.Assert(fMB1.Equals(equal));
            Assertion.Assert(!fMB1.Equals(f12CHF));
            Assertion.Assert(!f12CHF.Equals(fMB1));
            Assertion.Assert(!fMB1.Equals(fMB2));
        }