Esempio n. 1
0
        public void PutShouldUpdateTheaterJob()
        {
            var dbcontext         = new BroadwayBuilderContext();
            var theaterService    = new TheaterService(dbcontext);
            var theaterJobService = new TheaterJobPostingService(dbcontext);

            var theater = new Theater("someTheater", "Regal", "theater st", "LA", "CA", "US", "323323");

            theaterService.CreateTheater(theater);
            dbcontext.SaveChanges();
            var jobPosting = new TheaterJobPosting(theater.TheaterID, "intern", "some decription", "title", "hours", "some requirements", "testType");

            theaterJobService.CreateTheaterJob(jobPosting);
            dbcontext.SaveChanges();
            var controller = new HelpWantedController();

            //Act
            jobPosting.Description = "testing";
            //TheaterJobResponseModel theaterJobResponseModel = new TheaterJobResponseModel(jobPosting);
            var actionResult = controller.EditTheaterJob(jobPosting);
            var response     = actionResult as NegotiatedContentResult <string>;
            var content      = response.Content;

            ////Assert
            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Content);
            Assert.AreEqual("Updated Job Posting", content);
            Assert.AreEqual((HttpStatusCode)200, response.StatusCode);

            theaterJobService.DeleteTheaterJob(jobPosting.HelpWantedID);
            theaterService.DeleteTheater(theater);
            dbcontext.SaveChanges();
        }
        public void EditTheaterJob_Should_ReturnErrorMessage()
        {
            //Arrange
            var controller        = new HelpWantedController();
            TheaterJobPosting job = null;

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

            //Assert
            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Content);
            Assert.AreEqual((HttpStatusCode)400, response.StatusCode);
        }