本文整理汇总了C#中Range.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Range.Equals方法的具体用法?C# Range.Equals怎么用?C# Range.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Range
的用法示例。
在下文中一共展示了Range.Equals方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EqualsTest
public void EqualsTest()
{
var range1 = new Range(1, 2);
var range2 = new Range(1, 2);
Assert.IsTrue(range1.Equals(range2));
Assert.IsFalse(range1 == range2);
var range3 = new Range(1, 3);
Assert.IsFalse(range1.Equals(range3));
}
示例2: EqualsShouldFailIfObjectIsNotRange
public void EqualsShouldFailIfObjectIsNotRange()
{
var a = new Range<int>(1, 3);
const int b = 1;
Assert.False(a.Equals(b));
}
示例3: Equals_should_return_correct_value
public void Equals_should_return_correct_value(int a1, int a2, int b1, int b2, bool expected)
{
var subject = new Range<int>(a1, a2);
var comparand = new Range<int>(b1, b2);
subject.Equals(comparand).Should().Be(expected);
}
示例4: EqualityOperatorTest
public void EqualityOperatorTest( float min1, float max1, float min2, float max2, bool areEqual )
{
Range range1 = new Range( min1, max1 );
Range range2 = new Range( min2, max2 );
Assert.AreEqual( range1.Equals( range2 ), areEqual );
Assert.AreEqual( range1 == range2, areEqual );
Assert.AreEqual( range1 != range2, !areEqual );
}
示例5: TestEqualFinancialRangesReturnTrue
public void TestEqualFinancialRangesReturnTrue()
{
Financial financialA = new Financial(CurrencyInfoProvider.Current.Get("GBP"), 10);
Financial financialB = new Financial(CurrencyInfoProvider.Current.Get("GBP"), 10);
Range<Financial> rangeA = new Range<Financial>(financialA, financialB);
Range<Financial> rangeB = new Range<Financial>(financialA, financialB);
Assert.IsTrue(rangeA.Equals(rangeB));
}
示例6: EqualsTest
public void EqualsTest()
{
var a = new Range<int>(1, 3);
var b = new Range<int>(1, 3);
Assert.True(a.Equals(b));
a = new Range<int>(1);
b = new Range<int>(1);
Assert.True(a.Equals(b));
a = new Range<int>(null, 1);
b = new Range<int>(null, 1);
Assert.True(a.Equals(b));
a = new Range<int>(null);
b = new Range<int>(null);
Assert.True(a.Equals(b));
}
示例7: equal_irange
public void equal_irange() {
IRange<double> a = new Range(0, 0);
IRange<double> b = new Range(1, 1);
var c = new Range(1, 2);
var d = new Range(3, 2);
var e = new Range(2, 1);
Assert.True(a.Equals(a));
Assert.True(b.Equals(b));
Assert.False(a.Equals(b));
Assert.False(b.Equals(a));
Assert.True(c.Equals(c));
Assert.True(d.Equals(d));
Assert.False(c.Equals(d));
Assert.False(d.Equals(c));
Assert.True(c.Equals(c));
Assert.True(e.Equals(e));
Assert.True(c.Equals(e));
Assert.True(e.Equals(c));
}
示例8: Should_not_be_equal
public void Should_not_be_equal()
{
// Arrange
var a = new Range<int>(1, 100);
var b = new Range<int>(1, 99);
// Act
var actual = a.Equals(b);
// Assert
actual.Should().BeFalse();
}