Пример #1
0
        public void TestEquals()
        {
            var tradeType = new TradeType { Code = "B", Name = "Buy" };
            var tradeType2 = tradeType;
            var clone = tradeType.Clone();

            Assert.AreNotSame(tradeType, clone);
            Assert.IsTrue(tradeType.Equals(tradeType2));
            Assert.IsTrue(tradeType2.Equals(tradeType));
            Assert.IsTrue(tradeType.Equals(clone));
            Assert.IsTrue(clone.Equals(tradeType));
            Assert.IsFalse(tradeType.Equals(new TradeType { Code = "B", Name = "Buy" }));
            Assert.IsFalse(new TradeType { Code = "B", Name = "Buy" }.Equals(tradeType));

            tradeType.Code = "  \tB \n ";
            Assert.IsTrue(clone.Equals(tradeType));
            Assert.IsTrue(tradeType.Equals(clone));
            tradeType.Name = "  Buy \n\r";
            Assert.IsTrue(clone.Equals(tradeType));
            Assert.IsTrue(tradeType.Equals(clone));

            tradeType.Description = "Some description";
            tradeType.Ordinal = 10;
            Assert.IsTrue(clone.Equals(tradeType));
            Assert.IsTrue(tradeType.Equals(clone));

            tradeType.Code = "b";
            Assert.IsFalse(clone.Equals(tradeType));
            Assert.IsFalse(tradeType.Equals(clone));

            tradeType.Code = "B";
            Assert.IsTrue(clone.Equals(tradeType));

            tradeType.Name = "buy";
            Assert.IsFalse(clone.Equals(tradeType));
            Assert.IsFalse(tradeType.Equals(clone));
        }
Пример #2
0
        public void TestEquals_DifferentTypes()
        {
            var customer = new Customer { Name = UnitTestHelper.SAMPLE_NAME };
            var tradeType = new TradeType { Name = UnitTestHelper.SAMPLE_NAME };

            Assert.IsFalse(tradeType.Equals(customer));
            Assert.IsFalse(customer.Equals(tradeType));
            Assert.IsFalse(tradeType.Equals(UnitTestHelper.SAMPLE_NAME));
            Assert.IsFalse(UnitTestHelper.SAMPLE_NAME.Equals(tradeType));
        }