public void GetSizes() { #region ASSIGN PizzaTypesRepo testRepo = new PizzaTypesRepo(); PizzaTypesAPIController testController = new PizzaTypesAPIController(testRepo); #endregion #region ACT var taskReturn = testController.GetSizes(); taskReturn.Wait(); var result = taskReturn.Result.Value; List <Size> testList = new List <Size>(result); #endregion #region ASSERT Assert.AreEqual(testList.Count, 3); Assert.AreEqual(testList[0].Id, 1); Assert.AreEqual(testList[0].BaseSize, "Small"); Assert.AreEqual(testList[0].S_Price, 5.99M); Assert.AreEqual(testList[1].Id, 2); Assert.AreEqual(testList[1].BaseSize, "Medium"); Assert.AreEqual(testList[1].S_Price, 7.99M); Assert.AreEqual(testList[2].Id, 3); Assert.AreEqual(testList[2].BaseSize, "Large"); Assert.AreEqual(testList[2].S_Price, 9.99M); #endregion }
public void GetSizes_EmptyDataList() { #region ASSIGN PizzaTypesRepo testRepo = new PizzaTypesRepo(false); PizzaTypesAPIController testController = new PizzaTypesAPIController(testRepo); #endregion #region ACT var taskReturn = testController.GetSizes(); taskReturn.Wait(); var result = taskReturn.Result.Result; #endregion #region ASSERT Assert.IsTrue(result is NotFoundResult); Assert.AreEqual((result as NotFoundResult).StatusCode, 404); #endregion }