本文整理汇总了C#中System.Data.SqlTypes.SqlGuid.CompareTo方法的典型用法代码示例。如果您正苦于以下问题:C# SqlGuid.CompareTo方法的具体用法?C# SqlGuid.CompareTo怎么用?C# SqlGuid.CompareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SqlTypes.SqlGuid
的用法示例。
在下文中一共展示了SqlGuid.CompareTo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CompareTo
public void CompareTo()
{
String TestString = "This is a test string";
SqlGuid test1 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-3EEEEEEEEEEE");
SqlGuid test2 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-2EEEEEEEEEEE");
SqlGuid test3 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-1EEEEEEEEEEE");
Assert.IsTrue (Test1.CompareTo (Test3) < 0, "#D01");
Assert.IsTrue (Test4.CompareTo (Test1) > 0, "#D02");
Assert.IsTrue (Test3.CompareTo (Test2) == 0, "#D03");
Assert.IsTrue (Test4.CompareTo (SqlGuid.Null) > 0, "#D04");
Assert.IsTrue (test1.CompareTo (test2) > 0, "#D05");
Assert.IsTrue (test3.CompareTo (test2) < 0, "#D06");
try {
Test1.CompareTo (TestString);
Assert.Fail("#D05");
} catch(Exception e) {
Assert.AreEqual (typeof (ArgumentException), e.GetType (), "#D06");
}
}
示例2: GreaterThanOrEqual
public static SqlBoolean GreaterThanOrEqual(SqlGuid x, SqlGuid y)
{
if(x.IsNull || y.IsNull)
return SqlBoolean.Null;
int res = x.CompareTo(y);
if(res >= 0)
return SqlBoolean.True;
return SqlBoolean.False;
}
示例3: CompareTo
public void CompareTo()
{
String TestString = "This is a test string";
SqlGuid test1 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-3EEEEEEEEEEE");
SqlGuid test2 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-2EEEEEEEEEEE");
SqlGuid test3 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-1EEEEEEEEEEE");
Assert ("#D01", Test1.CompareTo (Test3) < 0);
Assert ("#D02", Test4.CompareTo (Test1) > 0);
Assert ("#D03", Test3.CompareTo (Test2) == 0);
Assert ("#D04", Test4.CompareTo (SqlGuid.Null) > 0);
Assert ("#D05", test1.CompareTo (test2) > 0);
Assert ("#D06", test3.CompareTo (test2) < 0);
try {
Test1.CompareTo (TestString);
Fail("#D05");
} catch(Exception e) {
AssertEquals ("#D06", typeof (ArgumentException), e.GetType ());
}
}
示例4: LessThan
public static SqlBoolean LessThan(SqlGuid x, SqlGuid y)
{
if(x.IsNull || y.IsNull)
return SqlBoolean.Null;
int res = x.CompareTo(y);
if(res < 0)
return SqlBoolean.True;
return SqlBoolean.False;
}
示例5: CompareTo
public void CompareTo()
{
string TestString = "This is a test string";
SqlGuid test1 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-3EEEEEEEEEEE");
SqlGuid test2 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-2EEEEEEEEEEE");
SqlGuid test3 = new SqlGuid("1AAAAAAA-BBBB-CCCC-DDDD-1EEEEEEEEEEE");
Assert.True(_test1.CompareTo(_test3) < 0);
Assert.True(_test4.CompareTo(_test1) > 0);
Assert.True(_test3.CompareTo(_test2) == 0);
Assert.True(_test4.CompareTo(SqlGuid.Null) > 0);
Assert.True(test1.CompareTo(test2) > 0);
Assert.True(test3.CompareTo(test2) < 0);
try
{
_test1.CompareTo(TestString);
Assert.False(true);
}
catch (Exception e)
{
Assert.Equal(typeof(ArgumentException), e.GetType());
}
}