public void GetAllSheetsTest() { var repo = new TimeTrackerRepository(); List<Timesheet> timesheets = new List<Timesheet>(); timesheets = repo.GetAllTimeSheets(6); Assert.AreEqual(4, timesheets.Count); }
public void DeleteTimesheetTest() { var repo = new TimeTrackerRepository(); repo.DeleteTimesheet(1); List<Timesheet> listOfSheets = repo.GetAllTimeSheets(1); Assert.IsFalse(listOfSheets.Exists(p => p.TimesheetId == 1)); }
public void DeleteEmpTimesheetTest() { TimeTrackerOperations ops = new TimeTrackerOperations(); ops.DeleteSingleTimesheet(14); var repo = new TimeTrackerRepository(); List<Timesheet> listOfSheets = repo.GetAllTimeSheets(5); Assert.IsFalse(listOfSheets.Exists(p => p.TimesheetId == 15)); }
public void GetAllSheetsTest() { var repo = new TimeTrackerRepository(); List<Timesheet> timesheets = new List<Timesheet>(); timesheets = repo.GetAllTimeSheets(6); var timesheet = timesheets.FirstOrDefault(x=>x.TimesheetId==22); Assert.AreEqual(timesheet.EntryType, "Timesheet"); Assert.AreEqual(4, timesheets.Count); }
public void SubmitNewTimeSheet() { var repo = new TimeTrackerRepository(); var timesheet = new Timesheet() { DateOfTimesheet = new DateTime(1989, 02, 01), EmpId = 1, TotalHoursByDay = 2 }; repo.SubmitNewTimeSheet(timesheet); List<Timesheet> listOfSheets = repo.GetAllTimeSheets(1); Assert.AreEqual(8, listOfSheets.Count); }
public void SubmitTimeSheetTest() { TimeTrackerOperations ops = new TimeTrackerOperations(); var timesheet = new Timesheet() { DateOfTimesheet = new DateTime(1989, 07, 01), EmpId = 1, TotalHoursByDay = 12 }; ops.SubmitTimeSheet(timesheet); var repo = new TimeTrackerRepository(); List<Timesheet> listOfSheets = repo.GetAllTimeSheets(1); Assert.AreEqual(6, listOfSheets.Count); }
public Response<TimeTrackerSummary> GetTimeTrackerSummary(int empId) { TimeTrackerRepository repo = new TimeTrackerRepository(); var response = new Response<TimeTrackerSummary>(); List<Timesheet> listOfTimesheets = repo.GetAllTimeSheets(empId); try { if (listOfTimesheets.Count > 0) { response.Success = true; response.Data = new TimeTrackerSummary() { SelectedEmployee = repo.GetSingleEmployee(empId), TotalHoursWorked = repo.TotalHoursWorked(empId), AllTimesheets = listOfTimesheets }; } else { response.Data = new TimeTrackerSummary() { SelectedEmployee = repo.GetSingleEmployee(empId), }; response.Success = false; response.Message = "There were no timesheets found for that employee"; } } catch (Exception ex) { response.Success = false; response.Message = ex.Message; } return response; }