本文整理汇总了C#中Company.CompareTo方法的典型用法代码示例。如果您正苦于以下问题:C# Company.CompareTo方法的具体用法?C# Company.CompareTo怎么用?C# Company.CompareTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Company
的用法示例。
在下文中一共展示了Company.CompareTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestJsonSerialization
public void TestJsonSerialization()
{
try
{
IComparable<Company> hs = new Company();
var some =
from c in new TestClientDataContext().Companies
where hs.CompareTo(c) != 0
select c;
TestTransformationFramework.CSharpToJS(some.Expression);
}
catch (Exception ex)
{
var ex0 = ex;
Assert.AreEqual(typeof(CSharpToJSException), ex0.GetType());
Assert.IsNotNull(ex0.InnerException);
var ex0_kvps = ((RelinqException)ex0).PrettyProperties;
Assert.AreEqual("JsonSerialization", ex0_kvps["Type"]);
Assert.AreEqual("value(Relinq.Infrastructure.Client.Beans.Bean`1[Relinq.Playground.Domain.Company]).Where(c => (value(Relinq.Playground.RelinqScriptBuilderExceptionsTests+<>c__DisplayClass8).hs.CompareTo(c) != 0))", ex0_kvps["Input"]);
Assert.AreEqual("False", ex0_kvps["IsUnexpected"]);
var ex1 = ex0.InnerException;
Assert.AreEqual(typeof(LinqVisitorException), ex1.GetType());
Assert.IsNotNull(ex1.InnerException);
var ex1_kvps = ((RelinqException)ex1).PrettyProperties;
Assert.AreEqual("value(Relinq.Infrastructure.Client.Beans.Bean`1[Relinq.Playground.Domain.Company]).Where(c => (value(Relinq.Playground.Domain.Company).CompareTo(c) != 0))", ex1_kvps["Root"]);
Assert.AreEqual("value(Relinq.Playground.Domain.Company)", ex1_kvps["Expression"]);
Assert.AreEqual("Constant", ex1_kvps["ExpressionType"]);
Assert.AreEqual("False", ex1_kvps["IsUnexpected"]);
var ex2 = ex1.InnerException;
Assert.AreEqual(typeof(JsonSerializationException), ex2.GetType());
Assert.IsNull(ex2.InnerException);
var ex2_kvps = ((RelinqException)ex2).PrettyProperties;
Assert.AreEqual("ActualVsExpectedTypeMismatch", ex2_kvps["Type"]);
Assert.AreEqual("Relinq.Playground.Domain.Company", ex2_kvps["Root"]);
Assert.AreEqual("Relinq.Playground.Domain.Company", ex2_kvps["RootActualType"]);
Assert.AreEqual("System.IComparable`1[Relinq.Playground.Domain.Company]", ex2_kvps["RootExpectedType"]);
Assert.AreEqual("Relinq.Playground.Domain.Company", ex2_kvps["Target"]);
Assert.AreEqual("Relinq.Playground.Domain.Company", ex2_kvps["ActualType"]);
Assert.AreEqual("System.IComparable`1[Relinq.Playground.Domain.Company]", ex2_kvps["ExpectedType"]);
Assert.AreEqual("Serialization metadata for type 'System.IComparable`1[[Relinq.Playground.Domain.Company, Relinq.Playground, Version=0.0.0.0, Culture=neutral, PublicKeyToken=ab3a3fb55cfc23d5]]': IsList = False, IsDictionary = False, IsPropertyBag = False, Properties = ", ex2_kvps["Metadata"]);
Assert.AreEqual("False", ex2_kvps["IsUnexpected"]);
return;
}
Assert.Fail("Expected exception wasn't thrown");
}