示例#1
0
        public void TestPutPruba1()
        {
            //Arrange
            Pruba1Controller pruba1Controller = new Pruba1Controller();
            Pruba1           PruebaEsperada   = new Pruba1()
            {
                FriendofZambrana = "Daniel Zambrana",
                ZambranaID       = 1,
                Email            = "*****@*****.**",
                Birthdate        = DateTime.Today,
                Place            = CategoryType.Administrativo
            };
            String newname = "Maely Zambrana";

            //Act
            var actionResult = pruba1Controller.PostPruba1(PruebaEsperada);

            PruebaEsperada.FriendofZambrana = newname;
            var actionResultPut = pruba1Controller.PutPruba1(PruebaEsperada.ZambranaID, PruebaEsperada) as StatusCodeResult;


            //Assert
            Assert.IsNotNull(actionResultPut);
            Assert.AreEqual(HttpStatusCode.NoContent, actionResultPut.StatusCode);
            Assert.IsInstanceOfType(actionResultPut, typeof(StatusCodeResult));
        }
示例#2
0
        public void TestPostPruba1()
        {
            //Arrange
            Pruba1Controller pruba1Controller = new Pruba1Controller();
            Pruba1           PruebaEsperada   = new Pruba1()
            {
                FriendofZambrana = "Daniel Zambrana",
                ZambranaID       = 1,
                Email            = "*****@*****.**",
                Birthdate        = DateTime.Today,
                Place            = CategoryType.Administrativo
            };

            //Act
            IHttpActionResult actionResult = pruba1Controller.PostPruba1(PruebaEsperada);
            var Pruba1Actual = actionResult as CreatedAtRouteNegotiatedContentResult <Pruba1>;


            //Assert
            Assert.IsNotNull(Pruba1Actual);
            Assert.AreEqual("DefaultApi", Pruba1Actual.RouteName);
            Assert.AreEqual(PruebaEsperada.FriendofZambrana, Pruba1Actual.Content.FriendofZambrana);
            Assert.AreEqual(PruebaEsperada.Email, Pruba1Actual.Content.Email);
            Assert.AreEqual(PruebaEsperada.Birthdate, Pruba1Actual.Content.Birthdate);
            Assert.AreEqual(PruebaEsperada.Place, Pruba1Actual.Content.Place);
        }