public void GetAllShows() { //Arange var controller = new ShowController(new ShowService()); var show = new Show { Name = "Test Retrieval of Show", Description = "Description of Retrieved Show", ThumbnailUrl = "https://upload.wikimedia.org/wikipedia/en/1/18/Shaw_Media_Logo_2012.png", VideoUrl = "http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4" }; var addedShow = controller.Post(show); //Act var retrievedShows = controller.Get(); //Assert Assert.IsTrue(retrievedShows.Count() > 0); var showsWithId = retrievedShows.Where(s => s.Id == addedShow.Id); Assert.AreEqual(showsWithId.Count(), 1); var showWithId = showsWithId.First(); Assert.AreEqual(showWithId.Id, addedShow.Id); Assert.AreEqual(showWithId.Name, addedShow.Name); Assert.AreEqual(showWithId.Description, addedShow.Description); Assert.AreEqual(showWithId.ThumbnailUrl, addedShow.ThumbnailUrl); Assert.AreEqual(showWithId.VideoUrl, addedShow.VideoUrl); }
public void DeleteShow() { //Arrange var controller = new ShowController(new ShowService()); var show = new Show { Name = "Test Creation of Show", Description = "Description of Created Show", ThumbnailUrl = "https://upload.wikimedia.org/wikipedia/en/1/18/Shaw_Media_Logo_2012.png", VideoUrl = "http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4" }; var addedShow = controller.Post(show); //Act bool result = controller.Delete(addedShow.Id); //Assert Assert.IsTrue(result); }
public void CreateShow() { //Arange var controller = new ShowController(new ShowService()); var show = new Show { Name = "Test Creation of Show", Description = "Description of Created Show", ThumbnailUrl = "https://upload.wikimedia.org/wikipedia/en/1/18/Shaw_Media_Logo_2012.png", VideoUrl = "http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4" }; //Act var addedShow =controller.Post(show); //Assert Assert.AreNotEqual(addedShow.Id, 0); Assert.AreEqual(addedShow.Name, show.Name); Assert.AreEqual(addedShow.Description, show.Description); Assert.AreEqual(addedShow.ThumbnailUrl, show.ThumbnailUrl); Assert.AreEqual(addedShow.VideoUrl, show.VideoUrl); }
public void UpdateShow() { //Arrange var controller = new ShowController(new ShowService()); var show = new Show { Name = "Test Creation of Show", Description = "Description of Created Show", ThumbnailUrl = "https://upload.wikimedia.org/wikipedia/en/thumb/f/fa/Shaw_Communications_logo_(1997).svg/220px-Shaw_Communications_logo_(1997).svg.png", VideoUrl = "http://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_1mb.mp4" }; var addedShow = controller.Post(show); //Act var ShowToUpdate = addedShow; ShowToUpdate.Name = "Updated Name"; ShowToUpdate.Description = "Updated Description"; ShowToUpdate.ThumbnailUrl = "https://upload.wikimedia.org/wikipedia/en/1/18/Shaw_Media_Logo_2012.png"; ShowToUpdate.VideoUrl = "http://techslides.com/demos/sample-videos/small.mp4"; var updatedShow = controller.Put(ShowToUpdate); //Assert Assert.AreEqual(updatedShow.Id, ShowToUpdate.Id); Assert.AreEqual(updatedShow.Name, ShowToUpdate.Name); Assert.AreEqual(updatedShow.Description, ShowToUpdate.Description); Assert.AreEqual(updatedShow.ThumbnailUrl, show.ThumbnailUrl); Assert.AreEqual(updatedShow.VideoUrl, show.VideoUrl); }