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 Response<List<Employee>> GetAllEmployees() { TimeTrackerRepository repo = new TimeTrackerRepository(); var response = new Response<List<Employee>>(); List<Employee> listOfEmployees = repo.GetAllEmployees(); try { if (listOfEmployees.Count > 0) { response.Success = true; response.Data = listOfEmployees; } else { response.Success = false; response.Message = "There were no employees found"; } } catch (Exception ex) { response.Success = false; response.Message = ex.Message; } return response; }
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; }
public void TotalHoursWorkedTest() { var repo = new TimeTrackerRepository(); int totalHoursWorked = repo.TotalHoursWorked(6); Assert.AreEqual(22, totalHoursWorked); }
public void GetSingleEmployeeTest() { var repo = new TimeTrackerRepository(); Employee singleEmployee = repo.GetSingleEmployee(6); Assert.AreEqual("Lisa", singleEmployee.FirstName); }
public void GetAllEmployeesTest() { var repo = new TimeTrackerRepository(); List<Employee> allEmployees = repo.GetAllEmployees(); Assert.AreEqual(14, allEmployees.Count); }
public void SubmitTimeSheet(Timesheet timesheet) { TimeTrackerRepository repo = new TimeTrackerRepository(); repo.SubmitNewTimeSheet(timesheet); }
public void DeleteSingleTimesheet(int timesheetId) { TimeTrackerRepository repo = new TimeTrackerRepository(); repo.DeleteTimesheet(timesheetId); }