Example #1
0
        public void ProblemVMGetAllShouldReturnList()
        {
            ProblemViewModel        vm    = new ProblemViewModel();
            List <ProblemViewModel> probs = vm.GetAll();

            Assert.IsTrue(probs.Count > 0);
        }
Example #2
0
 public IHttpActionResult Get()
 {
     try
     {
         ProblemViewModel        prob        = new ProblemViewModel();
         List <ProblemViewModel> allProblems = prob.GetAll();
         return(Ok(allProblems));
     }
     catch (Exception ex)
     {
         return(BadRequest("Retrieve failed - " + ex.Message));
     }
 }
 public IActionResult GetAll()
 {
     try
     {
         ProblemViewModel        viewModel   = new ProblemViewModel();
         List <ProblemViewModel> allProblems = viewModel.GetAll();
         return(Ok(allProblems));
     }
     catch (Exception ex)
     {
         _logger.LogError("Problem in " + GetType().Name + " " +
                          MethodBase.GetCurrentMethod().Name + " " + ex.Message);
         return(StatusCode(StatusCodes.Status500InternalServerError));
     }
 }
Example #4
0
    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