public static async Task<History> GetHistoryAsync(this IMarketsFeature feature, string symbol, string interval = "daily", DateTimeOffset? start = null, DateTimeOffset? end = null) {
            var path = new PathString("/v1/markets/history").Add(new {
                symbol = symbol,
                interval = interval,
                start = start?.ToString("yyyy-MM-dd"),
                end = start?.ToString("yyyy-MM-dd")
            });

            return await feature.Client.GetAsync<History>(path);
        }
 internal static Task WriteResponseBodyAsync(HttpResponse response, string uid, DateTimeOffset? datetime, TimeSpan? duration, string summary, string description, string location) {
     return response.WriteAsync(
         "BEGIN:VCALENDAR\r\n" +
         "VERSION:2.0\r\n" +
         "BEGIN:VEVENT\r\n" +
         "UID:" + uid + "\r\n" +
         "DTSTART:" + datetime?.ToString(DateTimeFormat) + "\r\n" +
         "DTEND:" + datetime?.Add(duration ?? TimeSpan.Zero).ToString(DateTimeFormat) + "\r\n" +
         "SUMMARY:" + summary + "\r\n" +
         "DESCRIPTION:" + description + "\r\n" +
         "LOCATION:" + location +
         "END:VEVENT\r\n" +
         "END:VCALENDAR\r\n");
 }
        private async Task GetLogEntries(DateTimeOffset? date)
        {
            var controller = CreateController();

            var result = await controller.LogEntries(date?.ToString("yyyyMMdd"));

            var actualDate = date ?? DateTimeOffset.Now.Date;
            var expectedResult = TestLogEntries.Where(l => l.Date == actualDate.Date).ToList();

            Assert.IsType<JsonResult<IEnumerable<LogEntryViewModel>>>(result);

            var res = result as JsonResult<IEnumerable<LogEntryViewModel>>;
            Assert.NotNull(res);

            foreach (var r in res.Content)
            {
                var original = expectedResult.First(l => l.Id == r.Id);

                Assert.Equal(original.Date, r.Date);
                Assert.Equal(LogFormatter.FormatLogEntry(original), r.Message);
                Assert.Equal(original.SourceUser, r.User);
            }
        }
Example #4
0
 /// <summary>
 /// Type-safe helper method for R.Iso8601
 /// </summary>
 public Iso8601 Iso8601(DateTimeOffset? datetime)
 {
     var str = datetime?.ToString("o");
     return Ast.Iso8601.FromString(str);
 }
 public override void SetExpire(DateTimeOffset? value)
 {
     _context.Response.Headers["Expires"] = value?.ToString("r", CultureInfo.InvariantCulture);
 }