public void TestGuidComparer() { string propName = "GuidProp"; Guid guid1 = new Guid("11111111-1111-1111-1111-111111111111"); Guid guid2 = new Guid("22222222-2222-2222-2222-222222222222"); Guid guid3 = new Guid("33333333-3333-3333-3333-333333333333"); _boCol[0].SetPropertyValue(propName, guid3); _boCol[1].SetPropertyValue(propName, guid1); _boCol[2].SetPropertyValue(propName, guid2); GuidComparer <MultiPropBO> comparer = new GuidComparer <MultiPropBO>(propName); _boCol.Sort(comparer); Assert.IsNull(_boCol[0].GetPropertyValue(propName)); Assert.AreEqual(guid1, _boCol[1].GetPropertyValue(propName)); Assert.AreEqual(guid2, _boCol[2].GetPropertyValue(propName)); Assert.AreEqual(guid3, _boCol[3].GetPropertyValue(propName)); }
public static BinaryExpression UnwrapPrimaryKeyBinary(BinaryExpression b) { if (b.Left.Type.UnNullify() == typeof(PrimaryKey) || b.Right.Type.UnNullify() == typeof(PrimaryKey)) { var left = UnwrapPrimaryKey(b.Left); var right = UnwrapPrimaryKey(b.Right); if (left.Type.UnNullify() == typeof(Guid)) { return(Expression.MakeBinary(b.NodeType, left.Nullify(), right.Nullify(), true, GuidComparer.GetMethod(b.NodeType))); } else { return(Expression.MakeBinary(b.NodeType, left.Nullify(), right.Nullify())); } } return(b); }
public void TestGuidComparer() { string propName = "GuidProp"; Guid guid1 = new Guid("11111111-1111-1111-1111-111111111111"); Guid guid2 = new Guid("22222222-2222-2222-2222-222222222222"); Guid guid3 = new Guid("33333333-3333-3333-3333-333333333333"); _boCol[0].SetPropertyValue(propName, guid3); _boCol[1].SetPropertyValue(propName, guid1); _boCol[2].SetPropertyValue(propName, guid2); GuidComparer<MultiPropBO> comparer = new GuidComparer<MultiPropBO>(propName); _boCol.Sort(comparer); Assert.IsNull(_boCol[0].GetPropertyValue(propName)); Assert.AreEqual(guid1, _boCol[1].GetPropertyValue(propName)); Assert.AreEqual(guid2, _boCol[2].GetPropertyValue(propName)); Assert.AreEqual(guid3, _boCol[3].GetPropertyValue(propName)); }