public void TestGet() { //arrange ZeballossController controller = new ZeballossController(); //act var result = controller.GetZeballos(); //assert Assert.IsNotNull(result); }
public void TestDelete() { //arrange ZeballossController controller = new ZeballossController(); Zeballos expected = new Zeballos() { ZeballosID = 10, FriendofZeballos = "Bob Smith", Place = CategoryType.Chocoloate, Email = "*****@*****.**", Birthdate = DateTime.Today }; //act IHttpActionResult actionResult = controller.PostZeballos(expected); IHttpActionResult actionDelete = controller.DeleteZeballos(expected.ZeballosID); //assert Assert.IsInstanceOfType(actionDelete, typeof(OkNegotiatedContentResult <Zeballos>)); }
public void TestPut() { //arrange ZeballossController controller = new ZeballossController(); Zeballos expected = new Zeballos() { ZeballosID = 10, FriendofZeballos = "Bob Smith", Place = CategoryType.Chocoloate, Email = "*****@*****.**", Birthdate = DateTime.Today }; //act IHttpActionResult actionResult = controller.PostZeballos(expected); var result = controller.PutZeballos(expected.ZeballosID, expected) as StatusCodeResult; //assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(StatusCodeResult)); Assert.AreEqual(HttpStatusCode.NoContent, result.StatusCode); }
public void TestPost() { //arrange ZeballossController controller = new ZeballossController(); Zeballos expected = new Zeballos() { ZeballosID = 10, FriendofZeballos = "Bob Smith", Place = CategoryType.Chocoloate, Email = "*****@*****.**", Birthdate = DateTime.Today }; //act var actionResult = controller.PostZeballos(expected); var createdResult = actionResult as CreatedAtRouteNegotiatedContentResult <Zeballos>; //assert Assert.IsNotNull(createdResult); Assert.AreEqual("DefaultApi", createdResult.RouteName); Assert.AreEqual(expected.FriendofZeballos, createdResult.Content.FriendofZeballos); }