public void TestComparingEdmSpatialTypeReference()
        {
            var geoCollection = new EdmSpatialTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.GeographyCollection), true);
            var point = new EdmSpatialTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.GeographyPoint), true);
            var point2 = new EdmSpatialTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.GeographyPoint), true);

            Assert.IsTrue(point.IsEquivalentTo(point2));
            Assert.IsFalse(geoCollection.IsEquivalentTo(point));
        }
예제 #2
0
        public void EqualitySpatialReferenceTypeTest()
        {
            var simpleBaseline = new EdmSpatialTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Geography), false);
            var simpleDifferentNullibility = new EdmSpatialTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Geography), true);
            var simpleDifferentPrimitiveType = new EdmSpatialTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.GeographyLineString), false);
            var simpleMatch = new EdmSpatialTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Geography), false);

            this.VerifyThrowsException(typeof(ArgumentNullException), () => new EdmSpatialTypeReference(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 EdmSpatialTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Geography), true, 3);
            var match = new EdmSpatialTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Geography), true, 3);
            var differentId = new EdmSpatialTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Geography), true, 4);
            var nullId = new EdmSpatialTypeReference(EdmCoreModel.Instance.GetPrimitiveType(EdmPrimitiveTypeKind.Geography), true, null);

            this.VerifyThrowsException(typeof(ArgumentNullException), () => new EdmTemporalTypeReference(null, true, 3));
            Assert.IsTrue(baseline.IsEquivalentTo(match), "Is the same.");
            Assert.IsFalse(baseline.IsEquivalentTo(differentId), "Different Id.");
            Assert.IsFalse(baseline.IsEquivalentTo(nullId), "Null Id");
        }