예제 #1
0
        public async Task GetVideosTest()
        {
            var videos = new List <Video>
            {
                new Video()
                {
                    Desc = "desc3", Url_Video = "url3", TherapyId = "4"
                },
                new Video()
                {
                    Desc = "desc4", Url_Video = "url4", TherapyId = "5"
                },
            };

            var fakeRepositoryMock = new Mock <IVideosRepo>();

            fakeRepositoryMock.Setup(x => x.GetAll()).ReturnsAsync(videos);


            var videoService = new VideosService(fakeRepositoryMock.Object);

            var resultVideos = await videoService.GetVideo();

            Assert.Collection(resultVideos, video =>
            {
                Assert.Equal("desc3", video.Desc);
                Assert.Equal("url3", video.Url_Video);
                Assert.Equal("4", video.TherapyId);
            },
                              video =>
            {
                Assert.Equal("desc4", video.Desc);
                Assert.Equal("url4", video.Url_Video);
                Assert.Equal("5", video.TherapyId);
            });
        }
예제 #2
0
        // GET: Videos
        public async Task <IActionResult> Index()
        {
            var videos = await _videosService.GetVideo();

            return(View(videos));
        }