public async Task use_datetimeoffset_argument() { var result = await HttpTesting.Scenario(_ => { _.Get.Url("/current/offset/time"); }); var time = DateTimeOffset.Parse(result.ResponseBody.ReadAsText()); var seconds = DateTimeOffset.UtcNow.Subtract(time).Seconds; Math.Abs(seconds).ShouldBeLessThan(1); }
public async Task use_date_timeoffset_route_arguments() { RoutedEndpoint.LastTimeOffset = DateTimeOffset.MinValue;; var time = new DateTimeOffset(2017, 8, 15, 8, 0, 0, 0, TimeSpan.Zero); await HttpTesting.Scenario(_ => { _.Get.Url("/with/dateoffset/" + time.ToString("o")); _.StatusCodeShouldBeOk(); }); RoutedEndpoint.LastTimeOffset.ShouldBe(time); }
public Task use_integer_route_argument() { var route = RouteBuilder.Build <RoutedEndpoint>(x => x.get_with_number_value(55)); var routes = HttpTesting.Runtime.Get <RouteGraph>(); return(HttpTesting.Scenario(_ => { _.Get.Url("/with/number/55"); _.ContentShouldBe("55"); })); }
public async Task use_date_time_route_arguments() { RoutedEndpoint.LastTime = DateTime.MinValue; var time = DateTime.Today.AddHours(3); await HttpTesting.Scenario(_ => { _.Get.Url("/with/date/" + time.ToString("o")); _.StatusCodeShouldBeOk(); }); RoutedEndpoint.LastTime.ShouldBe(time); }