Exemplo n.º 1
0
        public void TestDelete()
        {
            //ARRANGE
            MarinsController controller = new MarinsController();
            Marin            marin      = new Marin()
            {
                marinID       = 3,
                FriendofMarin = "Andre Velasco",
                place         = Places.Warnes,
                Email         = "*****@*****.**",
                Birthdate     = DateTime.Now
            };
            //ACT
            IHttpActionResult actionResultPost   = controller.PostMarin(marin);
            IHttpActionResult actionResultDelete = controller.DeleteMarin(marin.marinID);

            //ASSERT
            Assert.IsInstanceOfType(actionResultDelete, typeof(OkNegotiatedContentResult <Marin>));
        }
Exemplo n.º 2
0
        public void TestPut()
        {
            //ARRANGE
            MarinsController controller = new MarinsController();
            Marin            marin      = new Marin()
            {
                marinID       = 2,
                FriendofMarin = "Sebastian Ferrufino",
                place         = Places.Montero,
                Email         = "*****@*****.**",
                Birthdate     = DateTime.Now
            };
            //ACT
            IHttpActionResult actionResultPost = controller.PostMarin(marin);
            var result = controller.PutMarin(marin.marinID, marin) as StatusCodeResult;

            //ASSERT
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(StatusCodeResult));
            Assert.AreEqual(HttpStatusCode.NoContent, result.StatusCode);
        }
Exemplo n.º 3
0
        public void TestPost()
        {
            // ARRANGE
            MarinsController controller = new MarinsController();
            Marin            marin      = new Marin()
            {
                marinID       = 1,
                FriendofMarin = "Alberto Marin",
                place         = Places.Porongo,
                Email         = "*****@*****.**",
                Birthdate     = DateTime.Now
            };
            // ACT
            IHttpActionResult actionResult = controller.PostMarin(marin);
            var createdResult = actionResult as CreatedAtRouteNegotiatedContentResult <Marin>;

            // ASSERT
            Assert.IsNotNull(createdResult);
            Assert.AreEqual("DefaultApi", createdResult.RouteName);
            Assert.IsNotNull(createdResult.RouteValues["id"]);
        }