public void ProblemDAOGetAllShouldReturnList() { ProblemDAO dao = new ProblemDAO(); List <Problem> probs = dao.GetAll(); Assert.IsTrue(probs.Count > 0); }
/* * GetAll() * ViewModel Layer of GetAll, calls the ProblemDAO's GetAll method * Creates a list of ProblemViewModels for the web layer to access through jQuery */ public List <ProblemViewModel> GetAll() { List <ProblemViewModel> problemsViewModelList = new List <ProblemViewModel>(); try { List <Problem> problems = _dao.GetAll(); foreach (var problem in problems) { ProblemViewModel pVM = new ProblemViewModel(); pVM.Id = problem.GetIdAsString(); pVM.Description = problem.Description; pVM.Version = problem.Version; problemsViewModelList.Add(pVM); } } catch (Exception ex) { ViewModelUtils.ErrorRoutine(ex, "ProblemViewModel", "GetAll"); } return(problemsViewModelList); }
public void TestGetAllJustCrossFingersAndHopeItWorks() { if (!did_create_run) { TestCreateShouldReturnNewId(); } ProblemDAO dao = new ProblemDAO(); ProblemViewModel vm = new ProblemViewModel(); List <Problem> emp_list = dao.GetAll(); List <ProblemViewModel> vm_list = vm.GetAll(); Assert.IsTrue(emp_list.Count == vm_list.Count); for (int i = 0; i < emp_list.Count; i++) { Assert.IsTrue(emp_list[i].GetIdAsString() == vm_list[i].ProblemId); Assert.IsTrue(emp_list[i].Description == vm_list[i].Description); Assert.IsTrue(emp_list[i].Version == vm_list[i].Version); } }// TestGetAllJustCrossFingersAndHopeItWorks
public List <ProblemViewModel> GetAll() { List <ProblemViewModel> viewModels = new List <ProblemViewModel>(); try { List <Problem> problem = _dao.GetAll(); foreach (Problem prob in problem) { ProblemViewModel viewModel = new ProblemViewModel(); viewModel.Description = prob.Description; viewModel.Version = prob.Version; viewModel.ProblemId = prob.GetIdAsString(); viewModels.Add(viewModel); } } catch (Exception ex) { DALUtils.ErrorRoutine(ex, "ProblemViewModel", "GetAll"); } return(viewModels); }
public List <ProblemViewModel> GetAll() { List <ProblemViewModel> viewModels = new List <ProblemViewModel>(); try { List <Problem> Problems = _dao.GetAll(); foreach (Problem e in Problems) { //return only fields for display, subsequent get wil other fields ProblemViewModel viewModel = new ProblemViewModel(); viewModel.Id = e._id.ToString(); viewModel.Description = e.Description; viewModels.Add(viewModel); //add to list } } catch (Exception ex) { ErrorRoutine(ex, "ProblemViewModel", "GetAll"); } return(viewModels); }
public List <ProblemViewModel> GetAll() { List <ProblemViewModel> vmList = new List <ProblemViewModel>(); try { List <Problem> probList = _dao.GetAll(); foreach (Problem e in probList) { //return only fields for display, subsequent get will fill other fields ProblemViewModel viewModel = new ProblemViewModel(); viewModel.Id = e.GetIdAsString(); viewModel.Description = e.Description; vmList.Add(viewModel);//add to list } } catch (Exception ex) { ViewModelUtils.ErrorRoutine(ex, "ProblemViewModel", "GetAll"); } return(vmList); }