Ejemplo n.º 1
0
        public void GetShouldGetTheaterByName()
        {
            //Arrange
            var dbcontext = new BroadwayBuilderContext();
            var theater   = new Theater("createTheater", "Regal", "theater st", "LA", "CA", "US", "323323");
            var service   = new TheaterService(dbcontext);

            service.CreateTheater(theater);
            dbcontext.SaveChanges();
            var controller = new TheaterController();

            //Act
            var actionResult = controller.GetTheaterByName(theater.TheaterName);
            var response     = actionResult as NegotiatedContentResult <Theater>;
            var content      = response.Content;

            //Assert
            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Content);
            Assert.AreEqual(theater.TheaterName, content.TheaterName);
            Assert.AreEqual((HttpStatusCode)200, response.StatusCode);

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