public void TestComparingEdmBinaryTypeReference() { var binaryTypeWithDefaultValue = new EdmBinaryTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), true); var binaryType = new EdmBinaryTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), true, false, null); Assert.IsTrue(binaryType.IsEquivalentTo(binaryTypeWithDefaultValue)); var primitiveType = new EdmPrimitiveTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), true); Assert.IsFalse(binaryType.IsEquivalentTo(primitiveType)); }
public void EqualityBinaryReferenceTypeTest() { var simpleBaseline = new EdmBinaryTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), false); var simpleDifferentNullibility = new EdmBinaryTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), true); var simpleDifferentPrimitiveType = new EdmBinaryTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Stream), false); var simpleDifferentReferenceType = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), true); var simpleMatch = new EdmBinaryTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), false); this.VerifyThrowsException(typeof(ArgumentNullException), () => new EdmBinaryTypeReference(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."); Assert.IsTrue(simpleDifferentPrimitiveType.IsBad(), "simpleDifferentReferenceType is bad"); Assert.IsFalse(simpleBaseline.IsEquivalentTo(simpleDifferentReferenceType)); var baseline = new EdmBinaryTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), false, false, 3); var match = new EdmBinaryTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), false, false, 3); var differentMaxLength = new EdmBinaryTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), false, false, 2); var nullMaxLength = new EdmBinaryTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), false, false, null); var differentIsUnbounded = new EdmBinaryTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), false, true, null); var differentNullibility = new EdmBinaryTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), true, false, 3); var differentPrimitiveType = new EdmBinaryTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Int32), false, false, 3); var differentTypeReference = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), false); this.VerifyThrowsException(typeof(InvalidOperationException), () => new EdmBinaryTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), false, true, 3)); this.VerifyThrowsException(typeof(ArgumentNullException), () => new EdmBinaryTypeReference(null, false, false, 3)); Assert.IsTrue(baseline.IsEquivalentTo(match), "Is the same."); Assert.IsFalse(baseline.IsEquivalentTo(differentMaxLength), "Different MaxLength."); Assert.IsFalse(baseline.IsEquivalentTo(nullMaxLength), "Null MaxLength."); Assert.IsFalse(baseline.IsEquivalentTo(differentIsUnbounded), "Different IsUnbound."); Assert.IsFalse(baseline.IsEquivalentTo(differentNullibility), "Different nullibility."); Assert.IsFalse(baseline.IsEquivalentTo(differentPrimitiveType), "Different primtive type."); Assert.IsTrue(differentTypeReference.IsBad(), "differentTypeReference is bad"); Assert.IsFalse(baseline.IsEquivalentTo(differentTypeReference)); }