public void ShouldBeReturnResultsAfterUpdateOneVideoContent() { var options = new DbContextOptionsBuilder <EttvDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; var context = new EttvDbContext(options); Seed(context); var videocontentservice = new VideoContentService(unitOfWork: new UnitOfWork(context)); VideoContent vc = new VideoContent { VideoId = "videoId3", Title = "title3", Thumbnail = "thumbnail3", Tag = "tag3_Updated", SrcUri = "https://www.youtube.com/watch?v=", SrcExtention = "youtube", AppUserId = 2, Duration = 3000 }; Assert.Equal(vc.Tag, videocontentservice.Update("videoId3", vc).VideoContent.Tag); Assert.Equal(vc.Title, videocontentservice.Update("videoId3", vc).VideoContent.Title); Assert.Equal(vc.SrcUri, videocontentservice.Update("videoId3", vc).VideoContent.SrcUri); Assert.Equal(vc.SrcExtention, videocontentservice.Update("videoId3", vc).VideoContent.SrcExtention); }
public void ShouldBeReturnResultsAfterAddOneVideoContent() { var options = new DbContextOptionsBuilder <EttvDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; var context = new EttvDbContext(options); Seed(context); var videocontentservice = new VideoContentService(unitOfWork: new UnitOfWork(context)); VideoContent vc = new VideoContent { VideoId = "videoId4", Title = "title4", Thumbnail = "thumbnail4", Tag = "tag4", SrcUri = "https://www.youtube.com/watch?v=", SrcExtention = "youtube", AppUserId = 1, Duration = 1000 }; Assert.Equal(vc, videocontentservice.Save(vc).VideoContent); Assert.Equal(4, videocontentservice.List().Count()); }
public void ShouldResturnVideoContents() { var options = new DbContextOptionsBuilder <EttvDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; var context = new EttvDbContext(options); Seed(context); var videocontentservice = new VideoContentService(unitOfWork: new UnitOfWork(context)); Assert.Equal("title1", videocontentservice.List().Where(x => x.VideoId == "videoId1").SingleOrDefault().Title); Assert.Equal("title3", videocontentservice.List().Where(x => x.VideoId == "videoId3").LastOrDefault().Title); }
public void ShouldBeReturnResultsAfterDeleteOneVideoContent() { var options = new DbContextOptionsBuilder <EttvDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; var context = new EttvDbContext(options); Seed(context); var videocontentservice = new VideoContentService(unitOfWork: new UnitOfWork(context)); VideoContent vc = videocontentservice.Delete("videoId1").VideoContent; Assert.Equal("tag1", vc.Tag); Assert.Equal("title1", vc.Title); Assert.Equal(2, videocontentservice.List().Count()); }
public VideoContentController(IVideoContentService videoContentService, IMapper mapper) { _videoContentService = videoContentService as VideoContentService; _mapper = mapper; }