public void GetState_Valid() { #region ASSIGN StateRepo testRepo = new StateRepo(); StateApiController testController = new StateApiController(testRepo); #endregion #region ACT var taskReturn = testController.GetState(1); taskReturn.Wait(); var result = taskReturn.Result.Value; State testData = result; #endregion #region ASSERT Assert.AreEqual(testData.ID, 1); Assert.AreEqual(testData.Name, "Alaska"); Assert.AreEqual(testData.Abbreviation, "AK"); #endregion }
public void GetState_NonExistingID() { #region ASSIGN StateRepo testRepo = new StateRepo(); StateApiController testController = new StateApiController(testRepo); #endregion #region ACT var taskReturn = testController.GetState(0); taskReturn.Wait(); var result = taskReturn.Result.Result; #endregion #region ASSERT Assert.IsTrue(result is NotFoundResult); Assert.AreEqual((result as NotFoundResult).StatusCode, 404); #endregion }