Provides a request for the Google Maps Time Zone web service.
コード例 #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);
        }
コード例 #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);
        }
コード例 #3
0
        public async Task <TimeZoneResponse> GetResponseAsync(TimeZoneRequest request)
        {
            var url = new Uri(baseUri, request.ToUri());

            return(await http.GetAsync <TimeZoneResponse>(url));
        }
コード例 #4
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(baseUri, request.ToUri());

            return(http.Get <TimeZoneResponse>(url));
        }
コード例 #5
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>();
		}
コード例 #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>());
        }