Beispiel #1
0
        public void PostShouldAddTheater()
        {
            //Arrange
            var dbcontext  = new BroadwayBuilderContext();
            var theater    = new Theater("createTheater", "Regal", "theater st", "LA", "CA", "US", "323323");
            var service    = new TheaterService(dbcontext);
            var controller = new TheaterController();

            //Act
            var actionResult = controller.CreateTheater(theater);
            var response     = actionResult as NegotiatedContentResult <string>;
            var content      = response.Content;

            //Assert
            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Content);
            Assert.AreEqual("Theater Created", content);
            Assert.AreEqual((HttpStatusCode)201, response.StatusCode);

            Theater gettheater = service.GetTheaterByName("createTheater");

            service.DeleteTheater(gettheater);
            dbcontext.SaveChanges();
        }