public void GetTimeForZoneReturnsOkWithExistingZone()
 {
     var service = new TheService();
     var req = new HttpRequestMessage();
     var resp = new HttpResponseMessage();
     service.GetTimeForZone(req, resp, "Azores Standard Time");
     Assert.AreEqual(HttpStatusCode.OK, resp.StatusCode);
 }
 public void GetTimeReturnsOkStatusCode()
 {
     var service = new TheService();
     var req = new HttpRequestMessage();
     var resp = new HttpResponseMessage();
     service.GetTime(req,resp);
     Assert.AreEqual(HttpStatusCode.OK,resp.StatusCode);
 }
 public void GetTimeForZoneReturnsNotFoundWithUnexistingZone()
 {
     var service = new TheService();
     var req = new HttpRequestMessage();
     var resp = new HttpResponseMessage();
     service.GetTimeForZone(req, resp, "Unexistant zone");
     Assert.AreEqual(HttpStatusCode.NotFound, resp.StatusCode);
 }
 public void GetTimeReturnsCurrentTime()
 {
     var service = new TheService();
     var req = new HttpRequestMessage();
     var resp = new HttpResponseMessage();
     service.GetTime(req, resp);
     var s = resp.Content.ReadAsString();
     DateTime dt;
     Assert.True(DateTime.TryParse(s, out dt));
     var ts = DateTime.Now.Subtract(dt);
     Assert.True(ts.Duration().TotalSeconds < 1.0);
 }