public void TestComparingEdmDecimalTypeReference() { var decimalTypeWithPrecisionNull = new EdmDecimalTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Decimal), false, null, null); var decimalTypeWithPrecisionNotNull = new EdmDecimalTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Decimal), false, 1, null); Assert.IsFalse(decimalTypeWithPrecisionNull.IsEquivalentTo(decimalTypeWithPrecisionNotNull)); var primitiveType = new EdmPrimitiveTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Decimal), true); Assert.IsFalse(decimalTypeWithPrecisionNull.IsEquivalentTo(primitiveType)); }
public void EqualityDecimalReferenceTypeTest() { var simpleBaseline = new EdmDecimalTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Decimal), false); var simpleDifferentNullibility = new EdmDecimalTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Decimal), true); var simpleDifferentPrimitiveType = new EdmDecimalTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), false); var simpleMatch = new EdmDecimalTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Decimal), false); this.VerifyThrowsException(typeof(ArgumentNullException), () => new EdmDecimalTypeReference(null, false)); Assert.IsTrue(simpleBaseline.IsEquivalentTo(simpleMatch), "Is the same."); Assert.IsFalse(simpleBaseline.IsEquivalentTo(simpleDifferentNullibility), "Different nullibility."); Assert.IsFalse(simpleBaseline.IsEquivalentTo(simpleDifferentPrimitiveType), "Different primitive type."); var baseline = new EdmDecimalTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Decimal), true, 1, 3); var match = new EdmDecimalTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Decimal), true, 1, 3); var differentScale = new EdmDecimalTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Decimal), true, 1, 4); var nullScale = new EdmDecimalTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Decimal), true, 1, null); var differentPrecision = new EdmDecimalTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Decimal), true, 2, 3); var nullPrecision = new EdmDecimalTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Decimal), true, null, 3); var differentNullibility = new EdmDecimalTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Decimal), false, 1, 3); this.VerifyThrowsException(typeof(ArgumentNullException), () => new EdmDecimalTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.None), true, 1, 3)); this.VerifyThrowsException(typeof(ArgumentNullException), () => new EdmDecimalTypeReference(null, true, 1, 3)); Assert.IsTrue(baseline.IsEquivalentTo(match), "Is the same."); Assert.IsFalse(baseline.IsEquivalentTo(differentScale), "Different Scale."); Assert.IsFalse(baseline.IsEquivalentTo(nullScale), "Null Scale."); Assert.IsFalse(baseline.IsEquivalentTo(differentPrecision), "Different Precision."); Assert.IsFalse(baseline.IsEquivalentTo(nullPrecision), "Null Precision."); Assert.IsFalse(baseline.IsEquivalentTo(differentNullibility), "Different nullibility."); }