本文整理汇总了C#中TradeType.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# TradeType.Equals方法的具体用法?C# TradeType.Equals怎么用?C# TradeType.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TradeType
的用法示例。
在下文中一共展示了TradeType.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestEquals
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: TestEquals_DifferentTypes
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));
}