Equals() 공개 메소드

public Equals ( Object anObject ) : bool
anObject Object
리턴 bool
예제 #1
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));
        }
예제 #2
0
        public void MoneyBagEquals()
        {
            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));
        }
예제 #3
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));
        }