public async Task ClassWorkTestScenario() { //basic date interval test var recordsToBeExpected = await ClassworkRestClient.Instance().GetClassworkSummary(TestConstants.StartDate, TestConstants.EndDate); Assert.IsTrue(recordsToBeExpected.IsNotNullAndEmpty() && recordsToBeExpected.All(f => f.Date >= TestConstants.StartDate && f.Date <= TestConstants.EndDate)); //no record test var noRecordsExpected = await ClassworkRestClient.Instance().GetClassworkSummary(TestConstants.EndDate, TestConstants.EndDate); Assert.IsTrue(!noRecordsExpected.Any() || !recordsToBeExpected.All(f => f.Date >= TestConstants.StartDate && f.Date <= TestConstants.EndDate)); //basic paging check QueryParameter qp = new QueryParameter(); qp.Offset = 0; qp.Limit = 10; var getFirstTenRecords = await ClassworkRestClient.Instance().GetClassworkSummary(qp); Assert.IsTrue(getFirstTenRecords.Any() && getFirstTenRecords.Count == qp.Limit); //no record check qp = new QueryParameter(); qp.Offset = 10000000; qp.Limit = 10; noRecordsExpected = await ClassworkRestClient.Instance().GetClassworkSummary(qp); Assert.IsTrue(!noRecordsExpected.Any() || !recordsToBeExpected.All(f => f.Date >= TestConstants.StartDate && f.Date <= TestConstants.EndDate)); }
/// <summary> /// Classworks Summary Fetch Method /// </summary> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <returns></returns> public async Task <List <ClassworkSummary> > GetClassworkSummaryRecords(DateTime startDate, DateTime endDate) { List <ClassworkSummary> records = null; try { records = await ClassworkRestClient.Instance().GetClassworkSummary(startDate, endDate); } catch (Exception ex) { throw ex; } return(records); }