Provides a request for the Google Maps Time Zone web service.
Example #1
0
        public void TimeZoneService_Works_Outside_DST()
        {
            // Arrange
            var request = new TimeZoneRequest
            {
                Location  = new LatLng(52.8723, 0.8551),
                Timestamp = new DateTime(2017, 1, 1)
            };

            // Act
            var response = new TimeZoneService().GetResponse(request);

            // Assert
            Assert.AreEqual(ServiceResponseStatus.Ok, response.Status);
            Assert.AreEqual("Europe/London", response.TimeZoneID);
            Assert.AreEqual("Greenwich Mean Time", response.TimeZoneName);
            Assert.AreEqual(0, response.DstOffSet);
        }
Example #2
0
        public void TimeZoneService_Works_During_DST()
        {
            // Arrange
            var request = new TimeZoneRequest
            {
                Location  = new LatLng(52.8723, 0.8551),
                Timestamp = new DateTime(2017, 6, 13)
            };

            // Act
            var response = new TimeZoneService().GetResponse(request);

            // Assert
            Assert.AreEqual(ServiceResponseStatus.Ok, response.Status);
            Assert.AreEqual("Europe/London", response.TimeZoneID);
            Assert.AreEqual("British Summer Time", response.TimeZoneName);
            Assert.AreEqual(3600, response.DstOffSet);
        }
        public async Task <TimeZoneResponse> GetResponseAsync(TimeZoneRequest request)
        {
            var url = new Uri(baseUri, request.ToUri());

            return(await http.GetAsync <TimeZoneResponse>(url));
        }
        /// <summary>
        ///     Sends the specified request to the Google Maps Time Zone web
        ///     service and parses the response as an TimeZoneResponse
        ///     object.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public TimeZoneResponse GetResponse(TimeZoneRequest request)
        {
            var url = new Uri(baseUri, request.ToUri());

            return(http.Get <TimeZoneResponse>(url));
        }
		/// <summary>
		/// Sends the specified request to the Google Maps Time Zone web
		/// service and parses the response as an TimeZoneResponse
		/// object.
		/// </summary>
		/// <param name="request"></param>
		/// <returns></returns>
		public TimeZoneResponse GetResponse(TimeZoneRequest request)
		{
			var url = new Uri(this.BaseUri, request.ToUri());
			return Internal.Http.Get(url).As<TimeZoneResponse>();
		}
Example #6
0
        /// <summary>
        /// Sends the specified request to the Google Maps Time Zone web
        /// service and parses the response as an TimeZoneResponse
        /// object.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public TimeZoneResponse GetResponse(TimeZoneRequest request)
        {
            var url = new Uri(this.BaseUri, request.ToUri());

            return(Internal.Http.Get(url).As <TimeZoneResponse>());
        }