public void GetDetailedReportSince()
{
var timeEntryService = new TimeEntryService(Constants.ApiToken);
for (int i = 0; i < 6; i++)
{
var timeEntry = new TimeEntry()
{
IsBillable = true,
CreatedWith = "TimeEntryTestAdd",
Description = "Test Desc" + DateTime.Now.Ticks,
Duration = 900,
Start = DateTime.Now.AddDays(-i).ToIsoDateStr(),
Stop = DateTime.Now.AddDays(-i).AddMinutes(20).ToIsoDateStr(),
ProjectId = DefaultProjectId,
WorkspaceId = DefaultWorkspaceId
};
var expTimeEntry = timeEntryService.Add(timeEntry);
Assert.IsNotNull(expTimeEntry);
}
var standardParams = new DetailedReportParams()
{
UserAgent = "TogglAPI.Net",
WorkspaceId = DefaultWorkspaceId
};
var result = ReportService.Detailed(standardParams);
Assert.AreEqual(result.Data.Count, 6);
Assert.AreEqual(result.TotalCount, 6);
var te = new TimeEntry()
{
IsBillable = true,
CreatedWith = "TimeEntryTestAdd",
Description = "Test Desc" + DateTime.Now.Ticks,
Duration = 900,
Start = DateTime.Now.AddDays(-7).ToIsoDateStr(),
Stop = DateTime.Now.AddDays(-7).AddMinutes(20).ToIsoDateStr(),
ProjectId = DefaultProjectId,
WorkspaceId = DefaultWorkspaceId
};
var expTe = timeEntryService.Add(te);
Assert.IsNotNull(expTe);
result = ReportService.Detailed(standardParams);
Assert.AreEqual(result.Data.Count, 6);
Assert.AreEqual(result.TotalCount, 6);
result = ReportService.Detailed(new DetailedReportParams()
{
UserAgent = "test_api",
WorkspaceId = DefaultWorkspaceId,
Since = DateTime.Now.AddDays(-7).ToIsoDateStr()
});
Assert.AreEqual(result.Data.Count, 7);
Assert.AreEqual(result.TotalCount, 7);
}