private void SplitVideo(BaseItem v) { var das = new MediaBrowser.Api.DeleteAlternateSources(); das.Id = v.Id.ToString(); _videoService.Delete(das); }
public async Task <IActionResult> DeleteConfirmed(string id) { var video = await _videosService.DetailsVideos(id); await _videosService.Delete(video); return(RedirectToAction(nameof(Index))); }
public async Task RemoveTest() { var fake = Mock.Of <IVideosRepo>(); var videoService = new VideosService(fake); var video = new Video() { Desc = "desc2", Url_Video = "url2", TherapyId = "3" }; await videoService.Delete(video); }
public ActionResult <string> Delete(int id) { try { return(Ok(_vs.Delete(id))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task DeleteVideoCorrectly() { var videoList = new List <Video>(); var videoRepo = new Mock <IDeletableEntityRepository <Video> >(); videoRepo.Setup(x => x.All()).Returns(videoList.AsQueryable()); videoRepo.Setup(x => x.AddAsync(It.IsAny <Video>())) .Callback((Video c) => videoList.Add(c)); videoRepo.Setup(x => x.Delete(It.IsAny <Video>())) .Callback((Video c) => videoList.Remove(c)); await videoRepo.Object.AddAsync(this.test); var videoService = new VideosService(videoRepo.Object); await videoService.Delete(this.test.Id); Assert.False(this.test.IsDeleted); }
public async Task DeleteShouldBeSuccessfull() { var options = new DbContextOptionsBuilder <SportsNewsContext>() .UseInMemoryDatabase(databaseName: "VideosTests2") .Options; var dbContext = new SportsNewsContext(options); var repository = new DbRepository <Video>(dbContext); var videosService = new VideosService(repository); await videosService.Create(1, "dasasd"); await videosService.Create(1, "dasasd"); var id = repository.All().FirstOrDefault().Id; await videosService.Delete(id); var count = repository.All().Count(); Assert.Equal(1, count); }