Ejemplo n.º 1
0
        public void EnsureVlcVideoArgumentsArePassedCorrectly()
        {
            var audioConfig = MockRepository.GenerateMock <IAudioConfiguration>();

            audioConfig.Expect(x => x.GetPartArguments()).Return("!!AFOO!!");

            var videoConfig = MockRepository.GenerateMock <IVideoConfiguration>();

            videoConfig.Expect(x => x.GetPartArguments()).Return("!!VFOO!!");

            var portAllocator = MockRepository.GenerateMock <IPortAllocator>();

            portAllocator.Expect(x => x.NewPort()).Return(42);

            var job       = new VlcVideoJob(videoConfig, audioConfig, portAllocator, MockRepository.GenerateMock <IStatusParser>(), MockRepository.GenerateMock <IVlcStatusSource>(), new TimeSouce(), MockRepository.GenerateMock <ILogger>());
            var inputfile = TestUtilities.GetTestFile("SampleVideo_720x480_1mbH264.mp4");

            job.InputFile = inputfile;
            var expectedOutputFile = Path.Combine(TestUtilities.GetTestOutputDir(), "output.mp4");

            job.OutputFile = new FileInfo(expectedOutputFile);

            var expectedArguments = string.Format("-I http --http-password goose --http-port 42 \"{0}{2}SampleVideo_720x480_1mbH264.mp4\" \":sout=#transcode{{!!VFOO!!,!!AFOO!!}}:std{{dst='{1}{2}output.mp4',access=file}}\"", TestUtilities.GetTestDir(), TestUtilities.GetTestOutputDir(), Path.DirectorySeparatorChar);
            var actualArguments   = job.GetVlcArguments();

            Assert.AreEqual(expectedArguments, actualArguments);
        }
Ejemplo n.º 2
0
        public void EnsureExceptionWhenNoOutputFileInGiven()
        {
            var portAllocator = MockRepository.GenerateMock <IPortAllocator>();

            portAllocator.Expect(x => x.NewPort()).Return(42);

            var job = new VlcVideoJob(new VideoConfiguration(), new AudioConfiguration(), portAllocator, MockRepository.GenerateMock <IStatusParser>(), MockRepository.GenerateMock <IVlcStatusSource>(), new TimeSouce(), MockRepository.GenerateMock <ILogger>())
            {
                InputFile = new FileInfo("in.txt")
            };

            job.GetVlcArguments();
        }