Inheritance: GoogleApi.Entities.Places.Common.BasePlacesRequest, IJsonRequest
Example #1
0
        public void PlacesAddWhenApiKeyIsNullTest()
        {
            var request = new PlacesAddRequest
            {
                Key = null
            };

            var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.Add.Query(request));
            Assert.AreEqual(_exception.Message, "ApiKey must be provided");
        }
Example #2
0
        public void PlacesAddTest()
        {
            var request = new PlacesAddRequest
            {
                Key = this.ApiKey,
                Name = "Home",
                Types = new[] { PlaceLocationType.StreetAddress },
                Location = new Location(55.664425, 12.502264),
                Accuracy = 50,
                PhoneNumber = "+45 00000000",
                Address = "J. P. E. Hartmanns Allé 35 2500 Valby, Denmark",
                Website = "http://www.google.com",
                Language = "en-US"
            };
            var response = GooglePlaces.Add.Query(request);

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.PlaceId);
            Assert.AreEqual(response.Scope, Scope.App);
            Assert.AreEqual(response.Status, Status.Ok);
        }
Example #3
0
        public void PlacesAddWhenLocationIsNullTest()
        {
            var request = new PlacesAddRequest
            {
                Key = this.ApiKey,
                Name = "Home",
                Location = null
            };

            var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.Add.Query(request));
            Assert.AreEqual(_exception.Message, "Location must be provided.");
        }
Example #4
0
        public void PlacesAddWhenTypesIsNullTest()
        {
            var request = new PlacesAddRequest
            {
                Key = this.ApiKey,
                Name = "Home",
                Location = new Location(55.664425, 12.502264),
                Types = null
            };

            var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.Add.Query(request));
            Assert.AreEqual(_exception.Message, "Types must be provided. At least one type must be specified.");
        }
Example #5
0
        public void PlacesAddWhenNameIsStringEmptyTest()
        {
            var request = new PlacesAddRequest
            {
                Key = this.ApiKey,
                Name = string.Empty
            };

            var _exception = Assert.Throws<ArgumentException>(() => GooglePlaces.Add.Query(request));
            Assert.AreEqual(_exception.Message, "Name must be provided.");
        }