コード例 #1
0
        public void GetAllShows()
        {
            //Arange
            var service = new ShowService();
            var show = new Show
            {
                Name = "Test Retrieval",
                Description = "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 = service.Post(show);

            //Act
            var retrievedShows = service.GetAllShows();

            //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);
        }
コード例 #2
0
        public void DeleteShow()
        {
            //Arrange
            var service = new ShowService();
            var show = new Show
            {
                Name = "Test Creation ",
                Description = "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 = service.Post(show);

            //Act
            bool result = service.Delete(addedShow.Id);

            //Assert
            Assert.IsTrue(result);
        }
コード例 #3
0
        public void CreateShow()
        {
            //Arange
            var service = new ShowService();
            var show = new Show
            {
                Name = "Test Creation",
                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 = service.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);
        }
コード例 #4
0
        public void GetShow()
        {
            //Arange
            var service = new ShowService();
            var show = new Show
            {
                Name = "Test Retrieval ",
                Description = "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 = service.Post(show);

            //Act
            var retrievedShow = service.GetById(addedShow.Id);

            //Assert
            Assert.AreEqual(retrievedShow.Id, addedShow.Id);
            Assert.AreEqual(retrievedShow.Name, addedShow.Name);
            Assert.AreEqual(retrievedShow.Description, addedShow.Description);
            Assert.AreEqual(retrievedShow.ThumbnailUrl, addedShow.ThumbnailUrl);
            Assert.AreEqual(retrievedShow.VideoUrl, addedShow.VideoUrl);
        }
コード例 #5
0
        public void UpdateShow()
        {
            //Arrange
            var service = new ShowService();
            var show = new Show
            {
                Name = "Test Creation",
                Description = " 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://techslides.com/demos/sample-videos/small.mp4"
            };
            var addedShow = service.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://videoupdate.com";

            var updatedShow = service.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);
        }
コード例 #6
0
 // GET api/show/5
 public Show Get(int id)
 {
     this.ShowService = new ShowService();
     return this.ShowService.GetById(id);
 }
コード例 #7
0
        public IEnumerable<Show> Get()
        {
            this.ShowService = new ShowService();

            return this.ShowService.GetAllShows();
        }
コード例 #8
0
 public ShowController(ShowService showService)
 {
     _showService = showService;
 }
コード例 #9
0
 // GET api/show/5
 public Show Get(int id)
 {
     this.ShowService = new ShowService();
     return(this.ShowService.GetById(id));
 }
コード例 #10
0
        public IEnumerable <Show> Get()
        {
            this.ShowService = new ShowService();

            return(this.ShowService.GetAllShows());
        }