public void TestPut() { //ARRANGE TapiasController controller = new TapiasController(); Tapia tapia = new Tapia() { TapiaID = 1, FriendofTapia = "Camacho", place = Place.Hipermaxi, Email = "*****@*****.**", Birthdate = DateTime.Now }; //ACT IHttpActionResult actionResultPost = controller.PostTapia(tapia); var result = controller.PutTapia(tapia.TapiaID, tapia) as StatusCodeResult; }
public void TestDelete() { //ARRANGE TapiasController controller = new TapiasController(); Tapia tapia = new Tapia() { TapiaID = 1, FriendofTapia = "Camacho", place = Place.Hipermaxi, Email = "*****@*****.**", Birthdate = DateTime.Now }; //ACT IHttpActionResult actionResultPost = controller.PostTapia(tapia); IHttpActionResult actionResultDelete = controller.DeleteTapia(tapia.TapiaID); //ASSERT Assert.IsInstanceOfType(actionResultDelete, typeof(OkNegotiatedContentResult <Tapia>)); }
public void TestPost() { //ARRANGE TapiasController controller = new TapiasController(); Tapia tapia = new Tapia() { TapiaID = 1, FriendofTapia = "Camacho", place = Place.Hipermaxi, Email = "*****@*****.**", Birthdate = DateTime.Now }; //ACT IHttpActionResult actionResult = controller.PostTapia(tapia); var createdResult = actionResult as CreatedAtRouteNegotiatedContentResult <Tapia>; //ASSERT Assert.IsNotNull(createdResult); Assert.AreEqual("DefaultApi", createdResult.RouteName); Assert.IsNotNull(createdResult.RouteValues["id"]); }