Exemplo n.º 1
0
 public void WriteRawValueWritesGeometryValue()
 {
     RawValueWriter target = new RawValueWriter(this.settings, this.stream, new UTF32Encoding());
     var value2 = GeometryPoint.Create(1.2, 3.16);
     target.WriteRawValue(value2);
     this.StreamAsString(target).Should().Be("SRID=0;POINT (1.2 3.16)");
 }
Exemplo n.º 2
0
        public IEnumerable <Note> GetNotesByLocation(Geometry location, int userId = 0)
        {
            var point           = location as GeometryPoint;
            var geometryFactory = NtsGeometryServices.Instance.CreateGeometryFactory(srid: 4326);
            var geoPoint        = geometryFactory.CreatePoint(new NetTopologySuite.Geometries.Coordinate(point.X, point.Y));

            var x = dbContext.Notes.Select(n => n.Location.Distance(geoPoint));

            return(dbContext.Notes
                   //.Where(n => n.Location.IsWithinDistance(geoPoint, 0.01))
                   .Join(dbContext.Users, n => n.Owner.Id, u => u.Id, (n, u) => new { n, u })
                   .OrderBy(n => n.n.Location.Distance(geoPoint))
                   .Take(100)
                   .Select(nu => new Note
            {
                Id = nu.n.Id,
                Owner = new UserInfo
                {
                    Username = nu.u.Username,
                    Firstname = nu.u.Firstname,
                    Lastname = nu.u.Lastname
                },
                Body = nu.n.Body,
                Location = GeometryPoint.Create(nu.n.Location.Coordinate.X, nu.n.Location.Coordinate.Y)
            }));
        }
Exemplo n.º 3
0
        public void BindLiteralShouldReturnQueryNode()
        {
            var          value  = GeometryPoint.Create(5, 2);
            ConstantNode result = LiteralBinder.BindLiteral(new LiteralToken(value)) as ConstantNode;

            result.Value.Should().Be(value);
        }
Exemplo n.º 4
0
        public static GeometryPoint[] ConvertToLine(this GeometryPoint point, double heading, double lineLength)
        {
            double distance = lineLength / 2;
            List <GeometryPoint> linePoints = new List <GeometryPoint>();

            if (heading == 0 || heading == 180 || heading == 360)
            {
                linePoints.Add(GeometryPoint.Create(point.X + distance, point.Y));
                linePoints.Add(GeometryPoint.Create(point.X - distance, point.Y));
            }
            else if (heading == 90 || heading == 270)
            {
                linePoints.Add(GeometryPoint.Create(point.X, point.Y + distance));
                linePoints.Add(GeometryPoint.Create(point.X, point.Y - distance));
            }
            else
            {
                double m = Math.Tan(heading);
                double c = point.Y - (m * point.X);

                double positiveX = point.X + (distance / (Math.Sqrt(1 + (m * m))));
                double positiveY = (m * positiveX) + c;
                linePoints.Add(GeometryPoint.Create(positiveX, positiveY, null, m));

                double negativeX = point.X + ((-distance) / (Math.Sqrt(1 + (m * m))));
                double negativeY = (m * positiveX) + c;
                linePoints.Add(GeometryPoint.Create(negativeX, negativeY, null, m));

                //double xDifference = point.X - x;
                //double yDifference = point.Y - (m * x + c);
                //double d = Math.Sqrt(((point.X - x) * (point.X - x)) + ((point.Y - (m * x + c)) * (point.Y - (m * x + c))));
            }

            return(linePoints.ToArray());
        }
Exemplo n.º 5
0
        public void GeometryPointToGeometryShouldNotDoAnything()
        {
            var point  = GeometryPoint.Create(1, 2);
            var result = this.jsonConverter.ConvertPrimitiveValue(point, typeof(Geometry));

            result.Should().BeSameAs(point);
        }
Exemplo n.º 6
0
        public void StoringNoteForWrongUserId_shouldThrow()
        {
            var remarkService = new RemarkServices(landmarkRemarkContext);
            var location      = GeometryPoint.Create(-122.12, 47.67);

            remarkService.Invoking(rs => rs.CreateNote("testuser1", location, "Note A")).Should().Throw <UserNotFoundException>();
        }
Exemplo n.º 7
0
        public IActionResult UpdateNote(Model.Note note)
        {
            var username = HttpContext.User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.Upn).Value;

            remarkService.UpdateNote(username, note.Id, GeometryPoint.Create(note.X, note.Y), note.Body);
            return(Ok());
        }
Exemplo n.º 8
0
 public void BuildPropertyContextUriForSpatialPropertyValue()
 {
     foreach (ODataVersion version in Versions)
     {
         var contextUri = this.CreatePropertyContextUri(GeometryPoint.Create(1, 2), version);
         contextUri.OriginalString.Should().Be(BuildExpectedContextUri("#Edm.GeometryPoint"));
     }
 }
Exemplo n.º 9
0
        public void GeometryAndNullParameterValuesShouldWorkInPath()
        {
            var point     = GeometryPoint.Create(1, 2);
            Uri queryUri  = new Uri("Paintings(0)/Fully.Qualified.Namespace.GetColorAtPosition(position=geometry'" + SpatialHelpers.WriteSpatial(point) + "',includeAlpha=null)", UriKind.Relative);
            Uri actualUri = UriBuilder(queryUri, ODataUrlKeyDelimiter.Parentheses, settings);

            Assert.Equal(new Uri("http://gobbledygook/Paintings(0)/Fully.Qualified.Namespace.GetColorAtPosition(position=geometry'" + SpatialHelpers.WriteSpatial(point) + "',includeAlpha=null)"), actualUri);
        }
Exemplo n.º 10
0
        public void WriteRawValueWritesGeometryValue()
        {
            RawValueWriter target = new RawValueWriter(this.settings, this.stream, new UTF32Encoding());
            var            value  = GeometryPoint.Create(1.2, 3.16);

            target.WriteRawValue(value);
            Assert.Equal(@"{""type"":""Point"",""coordinates"":[1.2,3.16],""crs"":{""type"":""name"",""properties"":{""name"":""EPSG:0""}}}", this.StreamAsString(target));
        }
Exemplo n.º 11
0
        public void GeometryParameterShouldParseCorrectly()
        {
            var point = GeometryPoint.Create(1.0, 2.0);
            ICollection <OperationSegmentParameter> parsedParameters;

            TryParseOperationParameters("GetColorAtPosition", "position=geometry'" + SpatialHelpers.WriteSpatial(point) + "',includeAlpha=true", null, HardCodedTestModel.GetColorAtPositionFunction(), out parsedParameters).Should().BeTrue();
            parsedParameters.Should().HaveCount(2);
            parsedParameters.First().ShouldBeConstantParameterWithValueType("position", point);
        }
Exemplo n.º 12
0
        public void GeometryToGeographyInJson()
        {
            var point  = GeometryPoint.Create(1, 2);
            var result = this.jsonConverter.ConvertPrimitiveValue(point, typeof(GeographyPoint));

            result.Should().BeAssignableTo <GeographyPoint>();
            result.As <GeographyPoint>().Latitude.Should().BeInRange(2, 2);
            result.As <GeographyPoint>().Longitude.Should().BeInRange(1, 1);
        }
Exemplo n.º 13
0
        public void TestCreateMethod2DimensionsDefaultCoords()
        {
            GeometryPoint point = GeometryPoint.Create(15, 25);

            Assert.AreEqual(15, point.X);
            Assert.AreEqual(25, point.Y);
            Assert.IsFalse(point.Z.HasValue);
            Assert.IsFalse(point.M.HasValue);
            Assert.AreEqual(CoordinateSystem.DefaultGeometry, point.CoordinateSystem);
        }
Exemplo n.º 14
0
        public void TestCreateMethodAll4DimensionsDefaultCoords()
        {
            GeometryPoint point = GeometryPoint.Create(10, 20, 30, 40);

            Assert.AreEqual(10, point.X);
            Assert.AreEqual(20, point.Y);
            Assert.AreEqual(30, point.Z);
            Assert.AreEqual(40, point.M);
            Assert.AreEqual(CoordinateSystem.DefaultGeometry, point.CoordinateSystem);
        }
Exemplo n.º 15
0
        public void BasicTest()
        {
            GeometryPoint point1 = GeometryPoint.Create(1, 1);

            double expectedValue = 1.0;

            Assert.True(expectedValue.Equals(point1.X));
            Assert.True(expectedValue.Equals(point1.Y));
            Console.WriteLine(point1.CoordinateSystem);
        }
Exemplo n.º 16
0
        public void TranslatorSpatialLiteralTest()
        {
            var point = GeometryPoint.Create(1, 2);

            this.TestConstant(point, c =>
            {
                c.Value.Should().BeSameAs(point);
                c.Type.Should().Be(typeof(GeometryPoint));
            });
        }
Exemplo n.º 17
0
        public void GetNotesTakenOnLocation()
        {
            CreateNotes();
            var remarkService = new RemarkServices(landmarkRemarkContext);
            var notes         = remarkService.GetNotesByLocation(GeometryPoint.Create(-122.13, 47.68));

            notes.Should().HaveCount(3);
            notes.First().Body.Should().Be("Note C");
            notes.First().Owner.Username.Should().Be("testuser2");
        }
Exemplo n.º 18
0
        public void TestCreateMethod3DimensionsDefaultCoords()
        {
            CoordinateSystem coords = CoordinateSystem.Geometry(12);
            GeometryPoint    point  = GeometryPoint.Create(10, 20, 30);

            Assert.AreEqual(10, point.X);
            Assert.AreEqual(20, point.Y);
            Assert.AreEqual(30, point.Z);
            Assert.IsFalse(point.M.HasValue);
            Assert.AreEqual(CoordinateSystem.DefaultGeometry, point.CoordinateSystem);
        }
Exemplo n.º 19
0
        public void TestCreateMethod3DimensionsCustomCoords()
        {
            CoordinateSystem coords = CoordinateSystem.Geometry(12);
            GeometryPoint    point  = GeometryPoint.Create(coords, 10, 20, 30, 40);

            Assert.AreEqual(10, point.X);
            Assert.AreEqual(20, point.Y);
            Assert.AreEqual(30, point.Z);
            Assert.AreEqual(40, point.M);
            Assert.AreEqual(coords, point.CoordinateSystem);
        }
Exemplo n.º 20
0
 public static GeometryPoint CreateGeometryPoint(IDictionary <string, object> source)
 {
     return(GeometryPoint.Create(
                CoordinateSystem.Geometry(source.ContainsKey("CoordinateSystem")
             ? source.GetValueOrDefault <CoordinateSystem>("CoordinateSystem").EpsgId
             : null),
                source.GetValueOrDefault <double>("Latitude"),
                source.GetValueOrDefault <double>("Longitude"),
                source.GetValueOrDefault <double?>("Z"),
                source.GetValueOrDefault <double?>("M")));
 }
Exemplo n.º 21
0
        public async Task WriteRawGeometryValuesync()
        {
            var value = GeometryPoint.Create(1.2, 3.16);

            var result = await SetupRawValueWriterAndRunTestAsync(
                (rawValueWriter) => rawValueWriter.WriteRawValueAsync(value));

            Assert.Equal(
                "{\"type\":\"Point\",\"coordinates\":[1.2,3.16],\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"EPSG:0\"}}}",
                result);
        }
Exemplo n.º 22
0
        public void StoreNoteOnLocation()
        {
            CreateTestUser();
            var username = landmarkRemarkContext.Users.First().Username;
            var location = GeometryPoint.Create(-122.12, 47.67);

            var remarkService = new RemarkServices(landmarkRemarkContext);

            var noteId = remarkService.CreateNote(username, location, "Note A");

            noteId.Should().Be(1);
            landmarkRemarkContext.Notes.Should().HaveCount(1);
        }
Exemplo n.º 23
0
        private static GeometryPoint GeoUTMConverterXY(double lat, double lon, double zone)
        {
            double[] xy = MapLatLonToXY(lat, lon, UTMCentralMeridian(zone));

            xy[0] = xy[0] * UTMScaleFactor + 500000.0;
            xy[1] = xy[1] * UTMScaleFactor;
            if (xy[1] < 0.0)
            {
                xy[1] = xy[1] + 10000000.0;
            }

            return(GeometryPoint.Create(xy[0], xy[1]));
        }
Exemplo n.º 24
0
        public IActionResult GetNotes([FromQuery] double x, [FromQuery] double y)
        {
            var notes = remarkService.GetNotesByLocation(GeometryPoint.Create(x, y));

            //var notes = new[] {
            //    new Note { Id = 1, Body = "Note A", Location = GeometryPoint.Create(-122.12, 47.67), Owner = new UserInfo { Username = "******" } },
            //    new Note { Id = 2, Body = "Note B", Location = GeometryPoint.Create(-122.13, 47.68), Owner = new UserInfo { Username = "******" } }
            //};
            return(Ok(notes.Select(n => new Model.Note(
                                       id: n.Id,
                                       body: n.Body,
                                       x: (n.Location as GeometryPoint).X,
                                       y: (n.Location as GeometryPoint).Y,
                                       owner: n.Owner
                                       ))));
        }
Exemplo n.º 25
0
 public IEnumerable <Note> GetNotesByUser(int userId)
 {
     return(dbContext.Notes
            .Where(n => n.Owner.Id == userId)
            .Join(dbContext.Users, n => n.Owner.Id, u => u.Id, (n, u) => new { n, u })
            .Take(100)
            .Select(nu => new Note
     {
         Id = nu.n.Id,
         Owner = new UserInfo
         {
             Username = nu.u.Username,
             Firstname = nu.u.Firstname,
             Lastname = nu.u.Lastname
         },
         Body = nu.n.Body,
         Location = GeometryPoint.Create(nu.n.Location.Coordinate.X, nu.n.Location.Coordinate.Y)
     }));
 }
Exemplo n.º 26
0
        public void GetUserNotes()
        {
            CreateNotes();
            var userId = landmarkRemarkContext.Users.LastOrDefault().Id;

            var remarkService = new RemarkServices(landmarkRemarkContext);

            var notes = remarkService.GetNotesByUser(userId);

            notes.Should().HaveCount(2);
            var locations = notes.GroupBy(n => n.Location).Select(n => n.Key);

            locations.Should().HaveCount(2);
            locations.Should().BeEquivalentTo(new[] {
                GeometryPoint.Create(-122.12, 47.67),
                GeometryPoint.Create(-122.13, 47.68)
            });
            notes.Select(n => n.Body).Should().BeEquivalentTo(new[] { "Note B", "Note C" });
        }
Exemplo n.º 27
0
        public async Task <IEnumerable <DeviceEvent> > GetDeviceEventsAsync(double swLon, double swLat, double neLon, double neLat)
        {
            logger.LogInformation($"In GetDeviceEventsAsync. params = ({swLon},{swLat},{neLon},{neLat})");

            var results = new List <DeviceEvent>();

            var statementQuery = new SimpleStatement("select * from " + tableName + " where solr_query='{\"q\": \"*:*\", \"fq\":\"location:[\\\"" + swLon + " " + swLat + "\\\" TO \\\"" + neLon + " " + neLat + "\\\"]\"}' ORDER BY event_time DESC LIMIT " + MaxDeviceEvents);
            var rowSet         = await session.ExecuteAsync(statementQuery);

            foreach (Row row in rowSet)
            {
                var location  = (Dse.Geometry.Point)row["location"];
                var timestamp = (DateTimeOffset)row["event_time"];
                results.Add(new DeviceEvent
                {
                    id        = row["device_id"].ToString(),
                    Location  = GeometryPoint.Create(location.X, location.Y),
                    Timestamp = timestamp.DateTime
                });
            }

            return(results);
        }
Exemplo n.º 28
0
        public Note GetNoteById(int id)
        {
            var nu = dbContext.Notes
                     .Join(dbContext.Users, n => n.Owner.Id, u => u.Id, (n, u) => new { n, u })
                     .FirstOrDefault(n => n.n.Id == id);

            if (nu == null)
            {
                throw new NoteNotFoundException($"Note with {id} not found.");
            }
            return(new Note
            {
                Id = nu.n.Id,
                Owner = new UserInfo
                {
                    Username = nu.u.Username,
                    Firstname = nu.u.Firstname,
                    Lastname = nu.u.Lastname
                },
                Body = nu.n.Body,
                Location = GeometryPoint.Create(nu.n.Location.Coordinate.X, nu.n.Location.Coordinate.Y)
            });
        }
Exemplo n.º 29
0
        public ODataJsonLightPropertySerializerTests()
        {
            // Initialize open EntityType: EntityType.
            EdmModel edmModel = new EdmModel();

            myInt32 = new EdmTypeDefinition("TestNamespace", "MyInt32", EdmPrimitiveTypeKind.Int32);
            EdmTypeDefinitionReference myInt32Reference = new EdmTypeDefinitionReference(myInt32, true);

            edmModel.AddElement(myInt32);

            myString = new EdmTypeDefinition("TestNamespace", "MyString", EdmPrimitiveTypeKind.String);
            EdmTypeDefinitionReference myStringReference = new EdmTypeDefinitionReference(myString, true);

            edmModel.AddElement(myString);

            EdmEntityType edmEntityType = new EdmEntityType("TestNamespace", "EntityType", baseType: null, isAbstract: false, isOpen: true);

            edmEntityType.AddStructuralProperty("DeclaredProperty", EdmPrimitiveTypeKind.Guid);
            edmEntityType.AddStructuralProperty("DeclaredGeometryProperty", EdmPrimitiveTypeKind.Geometry);
            edmEntityType.AddStructuralProperty("DeclaredSingleProperty", EdmPrimitiveTypeKind.Single);
            edmEntityType.AddStructuralProperty("DeclaredDoubleProperty", EdmPrimitiveTypeKind.Double);
            edmEntityType.AddStructuralProperty("MyInt32Property", myInt32Reference);
            edmEntityType.AddStructuralProperty("MyStringProperty", myStringReference);
            edmEntityType.AddStructuralProperty("TimeOfDayProperty", EdmPrimitiveTypeKind.TimeOfDay);
            edmEntityType.AddStructuralProperty("DateProperty", EdmPrimitiveTypeKind.Date);

            edmModel.AddElement(edmEntityType);

            // Initialize open ComplexType: OpenAddress.
            this.openAddressType = new EdmComplexType("TestNamespace", "OpenAddress", baseType: null, isAbstract: false, isOpen: true);
            this.openAddressType.AddStructuralProperty("CountryRegion", EdmPrimitiveTypeKind.String);
            edmModel.AddElement(this.openAddressType);

            this.model            = TestUtils.WrapReferencedModelsToMainModel(edmModel);
            this.entityType       = edmEntityType;
            this.declaredProperty = new ODataProperty {
                Name = "DeclaredProperty", Value = Guid.Empty
            };
            this.undeclaredProperty = new ODataProperty {
                Name = "UndeclaredProperty", Value = DateTimeOffset.MinValue
            };
            this.declaredGeometryProperty = new ODataProperty {
                Name = "DeclaredGeometryProperty", Value = GeometryPoint.Create(0.0, 0.0)
            };
            this.declaredPropertyTimeOfDay = new ODataProperty {
                Name = "TimeOfDayProperty", Value = new TimeOfDay(1, 30, 5, 123)
            };
            this.declaredPropertyDate = new ODataProperty {
                Name = "DateProperty", Value = new Date(2014, 9, 17)
            };

            this.declaredPropertyCountryRegion = new ODataProperty()
            {
                Name = "CountryRegion", Value = "China"
            };
            this.declaredPropertyCountryRegionWithInstanceAnnotation = new ODataProperty()
            {
                Name  = "CountryRegion",
                Value = "China",
                InstanceAnnotations = new Collection <ODataInstanceAnnotation>
                {
                    new ODataInstanceAnnotation("Is.ReadOnly", new ODataPrimitiveValue(true))
                }
            };
            this.undeclaredPropertyCity = new ODataProperty()
            {
                Name = "City", Value = "Shanghai"
            };

            this.declaredPropertyMyInt32 = new ODataProperty()
            {
                Name = "MyInt32Property", Value = 12345
            };
            this.declaredPropertyMyInt32WithInstanceAnnotations = new ODataProperty()
            {
                Name  = "MyInt32Property",
                Value = 12345,
                InstanceAnnotations = new Collection <ODataInstanceAnnotation>
                {
                    new ODataInstanceAnnotation("Is.AutoComputable", new ODataPrimitiveValue(true)),
                    new ODataInstanceAnnotation("Is.ReadOnly", new ODataPrimitiveValue(false))
                }
            };
            this.declaredPropertyMyString = new ODataProperty()
            {
                Name = "MyStringProperty", Value = "abcde"
            };
        }
Exemplo n.º 30
0
        public ODataJsonLightPropertySerializerTests()
        {
            // Initialize open EntityType: EntityType.
            EdmModel edmModel = new EdmModel();

            myInt32 = new EdmTypeDefinition("TestNamespace", "MyInt32", EdmPrimitiveTypeKind.Int32);
            EdmTypeDefinitionReference myInt32Reference = new EdmTypeDefinitionReference(myInt32, true);

            edmModel.AddElement(myInt32);

            myString = new EdmTypeDefinition("TestNamespace", "MyString", EdmPrimitiveTypeKind.String);
            EdmTypeDefinitionReference myStringReference = new EdmTypeDefinitionReference(myString, true);

            edmModel.AddElement(myString);

            EdmEntityType edmEntityType = new EdmEntityType("TestNamespace", "EntityType", baseType: null, isAbstract: false, isOpen: true);

            edmEntityType.AddStructuralProperty("DeclaredProperty", EdmPrimitiveTypeKind.Guid);
            edmEntityType.AddStructuralProperty("DeclaredGeometryProperty", EdmPrimitiveTypeKind.Geometry);
            edmEntityType.AddStructuralProperty("DeclaredSingleProperty", EdmPrimitiveTypeKind.Single);
            edmEntityType.AddStructuralProperty("DeclaredDoubleProperty", EdmPrimitiveTypeKind.Double);
            edmEntityType.AddStructuralProperty("MyInt32Property", myInt32Reference);
            edmEntityType.AddStructuralProperty("MyStringProperty", myStringReference);
            edmEntityType.AddStructuralProperty("TimeOfDayProperty", EdmPrimitiveTypeKind.TimeOfDay);
            edmEntityType.AddStructuralProperty("DateProperty", EdmPrimitiveTypeKind.Date);
            edmEntityType.AddStructuralProperty("PrimitiveProperty", EdmPrimitiveTypeKind.PrimitiveType);

            // add derived type constraint property.
            var derivedTypeConstrictionProperty = edmEntityType.AddStructuralProperty("PrimitiveConstraintProperty", EdmPrimitiveTypeKind.PrimitiveType);
            var term = ValidationVocabularyModel.DerivedTypeConstraintTerm;
            IEdmStringConstantExpression stringConstant1 = new EdmStringConstant("Edm.Int32");
            IEdmStringConstantExpression stringConstant2 = new EdmStringConstant("Edm.Boolean");
            var collectionExpression = new EdmCollectionExpression(new[] { stringConstant1, stringConstant2 });
            EdmVocabularyAnnotation valueAnnotationOnProperty = new EdmVocabularyAnnotation(derivedTypeConstrictionProperty, term, collectionExpression);

            valueAnnotationOnProperty.SetSerializationLocation(edmModel, EdmVocabularyAnnotationSerializationLocation.Inline);
            edmModel.AddVocabularyAnnotation(valueAnnotationOnProperty);

            edmModel.AddElement(edmEntityType);

            // Initialize ComplexType: Address, HomeAddress, and OpenAddress
            this.addressType = new EdmComplexType("TestNamespace", "Address", baseType: null, isAbstract: false, isOpen: false);
            this.addressType.AddStructuralProperty("City", EdmPrimitiveTypeKind.String);
            this.derivedAddressType = new EdmComplexType("TestNamespace", "HomeAddress", baseType: this.addressType, isAbstract: false, isOpen: false);
            this.derivedAddressType.AddStructuralProperty("FamilyName", EdmPrimitiveTypeKind.String);

            this.openAddressType = new EdmComplexType("TestNamespace", "OpenAddress", baseType: null, isAbstract: false, isOpen: true);
            this.openAddressType.AddStructuralProperty("CountryRegion", EdmPrimitiveTypeKind.String);

            edmModel.AddElement(this.addressType);
            edmModel.AddElement(this.derivedAddressType);
            edmModel.AddElement(this.openAddressType);

            this.model            = TestUtils.WrapReferencedModelsToMainModel(edmModel);
            this.entityType       = edmEntityType;
            this.declaredProperty = new ODataProperty {
                Name = "DeclaredProperty", Value = Guid.Empty
            };
            this.undeclaredProperty = new ODataProperty {
                Name = "UndeclaredProperty", Value = DateTimeOffset.MinValue
            };
            this.declaredGeometryProperty = new ODataProperty {
                Name = "DeclaredGeometryProperty", Value = GeometryPoint.Create(0.0, 0.0)
            };
            this.declaredPropertyTimeOfDay = new ODataProperty {
                Name = "TimeOfDayProperty", Value = new TimeOfDay(1, 30, 5, 123)
            };
            this.declaredPropertyDate = new ODataProperty {
                Name = "DateProperty", Value = new Date(2014, 9, 17)
            };

            this.declaredPropertyAddress = new ODataProperty()
            {
                Name  = "AddressProperty",
                Value = new ODataResourceValue
                {
                    TypeName   = "TestNamespace.Address",
                    Properties = new ODataProperty[] { new ODataProperty {
                                                           Name = "City", Value = "Shanghai"
                                                       } }
                }
            };
            this.declaredPropertyHomeAddress = new ODataProperty()
            {
                Name  = "HomeAddressProperty",
                Value = new ODataResourceValue
                {
                    TypeName   = "TestNamespace.HomeAddress",
                    Properties = new ODataProperty[]
                    {
                        new ODataProperty {
                            Name = "FamilyName", Value = "Green"
                        },
                        new ODataProperty {
                            Name = "City", Value = "Shanghai"
                        }
                    }
                }
            };
            this.declaredPropertyAddressWithInstanceAnnotation = new ODataProperty()
            {
                Name  = "AddressProperty",
                Value = new ODataResourceValue
                {
                    TypeName   = "TestNamespace.Address",
                    Properties = new ODataProperty[]
                    {
                        new ODataProperty {
                            Name = "City", Value = "Shanghai"
                        }
                    },
                    InstanceAnnotations = new Collection <ODataInstanceAnnotation>
                    {
                        new ODataInstanceAnnotation("Is.ReadOnly", new ODataPrimitiveValue(true))
                    }
                }
            };
            this.declaredPropertyHomeAddressWithInstanceAnnotations = new ODataProperty()
            {
                Name  = "HomeAddressProperty",
                Value = new ODataResourceValue
                {
                    TypeName   = "TestNamespace.HomeAddress",
                    Properties = new ODataProperty[]
                    {
                        new ODataProperty
                        {
                            Name  = "FamilyName",
                            Value = "Green",
                            InstanceAnnotations = new Collection <ODataInstanceAnnotation>
                            {
                                new ODataInstanceAnnotation("FamilyName.annotation", new ODataPrimitiveValue(true))
                            }
                        },
                        new ODataProperty
                        {
                            Name  = "City",
                            Value = "Shanghai",
                            InstanceAnnotations = new Collection <ODataInstanceAnnotation>
                            {
                                new ODataInstanceAnnotation("City.annotation1", new ODataPrimitiveValue(true)),
                                new ODataInstanceAnnotation("City.annotation2", new ODataPrimitiveValue(123))
                            }
                        }
                    },
                    InstanceAnnotations = new Collection <ODataInstanceAnnotation>
                    {
                        new ODataInstanceAnnotation("Is.AutoComputable", new ODataPrimitiveValue(true)),
                        new ODataInstanceAnnotation("Is.ReadOnly", new ODataPrimitiveValue(false))
                    }
                }
            };

            this.declaredPropertyCountryRegion = new ODataProperty()
            {
                Name = "CountryRegion", Value = "China"
            };
            this.declaredPropertyCountryRegionWithInstanceAnnotation = new ODataProperty()
            {
                Name  = "CountryRegion",
                Value = "China",
                InstanceAnnotations = new Collection <ODataInstanceAnnotation>
                {
                    new ODataInstanceAnnotation("Is.ReadOnly", new ODataPrimitiveValue(true))
                }
            };
            this.undeclaredPropertyCity = new ODataProperty()
            {
                Name = "City", Value = "Shanghai"
            };

            this.declaredPropertyMyInt32 = new ODataProperty()
            {
                Name = "MyInt32Property", Value = 12345
            };
            this.declaredPropertyMyInt32WithInstanceAnnotations = new ODataProperty()
            {
                Name  = "MyInt32Property",
                Value = 12345,
                InstanceAnnotations = new Collection <ODataInstanceAnnotation>
                {
                    new ODataInstanceAnnotation("Is.AutoComputable", new ODataPrimitiveValue(true)),
                    new ODataInstanceAnnotation("Is.ReadOnly", new ODataPrimitiveValue(false))
                }
            };
            this.declaredPropertyMyString = new ODataProperty()
            {
                Name = "MyStringProperty", Value = "abcde"
            };
        }