Ejemplo n.º 1
0
 public ActionResult <IEnumerable <Flower> > Get()
 {
     try
     {
         return(Ok(_repo.GetAll()));
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
        public void GetAll()
        {
//Act
            var result = _objRepo.GetAll().ToList();

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(6, result.Count);
            Assert.AreEqual("Gül", result[0].Name);
            Assert.AreEqual("Papatya", result[2].Name);
            Assert.AreEqual("Orkide", result[4].Name);

            //Uncomment below the correct version is this I have added the line above for test
            //Assert.AreEqual(3, result.Count);
            //Assert.AreEqual("Gül", result[0].Name);
            //Assert.AreEqual("Papatya", result[1].Name);
            //Assert.AreEqual("Orkide", result[2].Name);
        }