Пример #1
0
        public void GetQueryStringParametersWhenNameIsStringEmptyTest()
        {
            var request = new PlacesAddRequest
            {
                Key  = this.ApiKey,
                Name = string.Empty
            };

            var exception = Assert.Throws <ArgumentException>(() =>
            {
                var parameters = request.GetQueryStringParameters();
                Assert.IsNull(parameters);
            });

            Assert.AreEqual(exception.Message, "Name must be provided");
        }
Пример #2
0
        public void GetQueryStringParametersWhenLocationIsNullTest()
        {
            var request = new PlacesAddRequest
            {
                Key      = this.ApiKey,
                Name     = "Home",
                Location = null
            };

            var exception = Assert.Throws <ArgumentException>(() =>
            {
                var parameters = request.GetQueryStringParameters();
                Assert.IsNull(parameters);
            });

            Assert.AreEqual(exception.Message, "Location must be provided");
        }
Пример #3
0
        public void GetQueryStringParametersWhenKeyIsStringEmptyTest()
        {
            var request = new PlacesAddRequest
            {
                Key      = string.Empty,
                Name     = "test",
                Location = new Location(0, 0),
                Types    = new[] { PlaceLocationType.Street_Address }
            };

            var exception = Assert.Throws <ArgumentException>(() =>
            {
                var parameters = request.GetQueryStringParameters();
                Assert.IsNull(parameters);
            });

            Assert.AreEqual(exception.Message, "Key is required");
        }
Пример #4
0
        public void GetQueryStringParametersWhenTypesIsEmptyTest()
        {
            var request = new PlacesAddRequest
            {
                Key      = this.ApiKey,
                Name     = "Home",
                Location = new Location(55.664425, 12.502264),
                Types    = new PlaceLocationType[0]
            };

            var exception = Assert.Throws <ArgumentException>(() =>
            {
                var parameters = request.GetQueryStringParameters();
                Assert.IsNull(parameters);
            });

            Assert.AreEqual(exception.Message, "Types must be provided. At least one type must be specified");
        }