public void TestGet() { //Arrange velascoesController controller = new velascoesController(); //Act var listaPersonas = controller.Getvelascoes(); //Assert Assert.IsNotNull(listaPersonas); }
public void TestDelete() { //Arrange velascoesController controller = new velascoesController(); velasco velasquito = new velasco() { velascoID = 3, Friendofvelasco = "Cesar Loayza", places = Places.Santa_Cruz, Email = "*****@*****.**", Birthdate = DateTime.Now }; //Act IHttpActionResult actionResultPost = controller.Postvelasco(velasquito); IHttpActionResult actionResultDelete = controller.Deletevelasco(velasquito.velascoID); //Assert Assert.IsInstanceOfType(actionResultDelete, typeof(OkNegotiatedContentResult <velasco>)); }
public void TestPut() { //Arrange velascoesController controller = new velascoesController(); velasco velasquito = new velasco() { velascoID = 2, Friendofvelasco = "Sebastian Ferrufino", places = Places.Beni, Email = "*****@*****.**", Birthdate = DateTime.Now }; //Act IHttpActionResult actionResult = controller.Postvelasco(velasquito); var result = controller.Putvelasco(velasquito.velascoID, velasquito) as StatusCodeResult; //Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(StatusCodeResult)); Assert.AreEqual(HttpStatusCode.NoContent, result.StatusCode); }
public void TestPost() { //Arrange velascoesController controller = new velascoesController(); velasco velasquito = new velasco() { velascoID = 1, Friendofvelasco = "Alberto Marin", places = Places.Santa_Cruz, Email = "*****@*****.**", Birthdate = DateTime.Now }; //Act IHttpActionResult actionResult = controller.Postvelasco(velasquito); var createdResult = actionResult as CreatedAtRouteNegotiatedContentResult <velasco>; //Assert Assert.IsNotNull(createdResult); Assert.AreEqual("DefaultApi", createdResult.RouteName); Assert.IsNotNull(createdResult.RouteValues["id"]); }