public void TestComparingEdmStringTypeReference() { var stringType = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), true); var stringTypeCopy = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), true); Assert.IsTrue(stringType.IsEquivalentTo(stringTypeCopy)); var stringTypeWithNullableFalse = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), false); var primitiveType = new EdmPrimitiveTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), true); Assert.IsFalse(stringType.IsEquivalentTo(primitiveType)); Assert.IsFalse(stringType.IsEquivalentTo(stringTypeWithNullableFalse)); }
public void EqualityStringReferenceTypeTest() { var simpleBaseline = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), false); var simpleDifferentNullibility = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), true); var simpleDifferentPrimitiveType = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Binary), false); var simpleMatch = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), false); this.VerifyThrowsException(typeof(ArgumentNullException), () => new EdmStringTypeReference(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 EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), true, false, 4, true); var match = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), true, false, 4, true); var differentUnicode = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), true, false, 4, false); var nullUnicode = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), true, false, 4, null); var differentMaxLength = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), true, false, 5, true); var nullMaxLength = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), true, false, null, true); var differentIsUnbounded = new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), true, true, null, true); this.VerifyThrowsException(typeof(ArgumentNullException), () => new EdmStringTypeReference(null, true, false, 4, true)); this.VerifyThrowsException(typeof(InvalidOperationException), () => new EdmStringTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.String), true, true, 4, true)); Assert.IsTrue(baseline.IsEquivalentTo(match), "Is the same."); Assert.IsFalse(baseline.IsEquivalentTo(differentUnicode), "Different Unicode"); Assert.IsFalse(baseline.IsEquivalentTo(nullUnicode), "Null Unicode"); Assert.IsFalse(baseline.IsEquivalentTo(differentMaxLength), "Different MaxLength"); Assert.IsFalse(baseline.IsEquivalentTo(nullMaxLength), "Null MaxLength"); Assert.IsFalse(baseline.IsEquivalentTo(differentIsUnbounded), "Different IsUnbounded"); }