Exemplo n.º 1
0
        public async Task StoreVideoAsync_GivenEnvVideoRootAndMockedVideo_MockedVideoIsStored()
        {
            //arrange
            var webhost = new Mock <IWebHostEnvironment>();
            var config  = new Mock <IConfiguration>();

            config.Setup(_ => _["VideoStoreRoot"]).Returns <IConfiguration, string>(null);
            webhost.Setup(_ => _.ContentRootPath).Returns(Directory.GetCurrentDirectory());
            var service    = new VideoStoreService(webhost.Object, config.Object);
            var video      = MockVideoFactory(1024);
            var videoProps = new Model.VideoProperties();

            using var cancel = new CancellationTokenSource();

            //act
            await service.StoreVideoAsync(video, videoProps, 1024, cancel.Token);

            //assert
            File.Exists(Path.Combine(service.VideoRoot, videoProps.VirtualFilePath)).Should().BeTrue();

            //clean
            await service.DeleteVideoAsync(videoProps);
        }
Exemplo n.º 2
0
 public VideostreamController(VideoStoreService videoStore, Vc_webapiContext db)
 {
     this.videoStore = videoStore;
     this.db         = db;
 }