public void Compare_Bool_Bool() { Assert.AreEqual(-1, DataServiceProviderMethods.Compare(false, true), "#A1"); Assert.AreEqual(0, DataServiceProviderMethods.Compare(false, false), "#A2"); Assert.AreEqual(1, DataServiceProviderMethods.Compare(true, false), "#A3"); Assert.AreEqual(0, DataServiceProviderMethods.Compare(true, true), "#A4"); }
public void Compare_String_String() { Assert.AreEqual(1, DataServiceProviderMethods.Compare("right", "left"), "#A1"); Assert.AreEqual(0, DataServiceProviderMethods.Compare("right", "right"), "#A2"); Assert.AreEqual(0, DataServiceProviderMethods.Compare(String.Empty, String.Empty), "#A3"); Assert.AreEqual(-1, DataServiceProviderMethods.Compare("left", "right"), "#A4"); Assert.AreEqual(-1, DataServiceProviderMethods.Compare(null, "right"), "#A5"); Assert.AreEqual(1, DataServiceProviderMethods.Compare("right", null), "#A6"); Assert.AreEqual(0, DataServiceProviderMethods.Compare((string)null, (string)null), "#A7"); }
public void Convert() { var rt = new ResourceType(typeof(string), ResourceTypeKind.ComplexType, null, "System", "String", false); AssertExtensions.Throws <NotImplementedException> (() => { DataServiceProviderMethods.Convert("test", rt); }, "#A1"); AssertExtensions.Throws <NotImplementedException> (() => { DataServiceProviderMethods.Convert(null, null); }, "#A2"); }
public void GetValue() { var rt = new ResourceType(typeof(string), ResourceTypeKind.ComplexType, null, "System", "String", false); var rp = new ResourceProperty("Length", ResourcePropertyKind.ComplexType, rt); AssertExtensions.Throws <NotImplementedException> (() => { DataServiceProviderMethods.GetValue("test", rp); }, "#A1"); AssertExtensions.Throws <NotImplementedException> (() => { DataServiceProviderMethods.GetValue(null, null); }, "#A2"); }
public void Compare_NullableBool_NullableBool() { Assert.AreEqual(-1, DataServiceProviderMethods.Compare((bool?)false, (bool?)true), "#A1"); Assert.AreEqual(0, DataServiceProviderMethods.Compare((bool?)false, (bool?)false), "#A2"); Assert.AreEqual(1, DataServiceProviderMethods.Compare((bool?)true, (bool?)false), "#A3"); Assert.AreEqual(0, DataServiceProviderMethods.Compare((bool?)true, (bool?)true), "#A4"); Assert.AreEqual(1, DataServiceProviderMethods.Compare((bool?)false, null), "#B1"); Assert.AreEqual(1, DataServiceProviderMethods.Compare((bool?)true, null), "#B2"); Assert.AreEqual(-1, DataServiceProviderMethods.Compare(null, (bool?)false), "#B3"); Assert.AreEqual(-1, DataServiceProviderMethods.Compare(null, (bool?)true), "#B4"); Assert.AreEqual(0, DataServiceProviderMethods.Compare((bool?)null, (bool?)null), "#B5"); }
public void Compare_Guid_Guid() { var guid1 = new Guid("bdec809c-f8c5-4bc9-8b56-fb34a12a3e1c"); var guid2 = new Guid("898b2fe2-3530-4f56-85de-79344e59a90f"); Assert.AreEqual(1, DataServiceProviderMethods.Compare(guid1, guid2), "#A1"); Assert.AreEqual(0, DataServiceProviderMethods.Compare(guid1, guid1), "#A2"); Assert.AreEqual(-1, DataServiceProviderMethods.Compare(guid2, guid1), "#A3"); guid1 = new Guid("00000000-0000-0000-0000-000000000000"); guid2 = new Guid("00000000-0000-0000-0000-000000000001"); Assert.AreEqual(-1, DataServiceProviderMethods.Compare(guid1, guid2), "#B1"); Assert.AreEqual(1, DataServiceProviderMethods.Compare(guid2, guid1), "#B2"); }