public void EnsureVlcLocationPathIsUsedByVlcDriver() { var locator = MockRepository.GenerateStub<IVlcLocator>(); var location = Path.Combine(TestUtilities.GetTestDir(), "myfakevlc.exe"); locator.Location = location; var starter = MockRepository.GenerateMock<IVlcStarter>(); var driver = new VlcDriver(starter, null, locator); Assert.AreEqual(location, driver.VlcExePath.FullName); starter.Expect(x => x.Start(Arg<string>.Is.Anything, Arg<FileInfo>.Is.Anything)).Repeat.Once(); driver.StartInstance(); var args = starter.GetArgumentsForCallsMadeOn(x => x.Start(null, null), x => x.IgnoreArguments()); var filePathArgument = args[0][1] as FileInfo; Assert.AreEqual(location, filePathArgument.FullName); starter.VerifyAllExpectations(); }
public void TestVlcConversionWithArguments() { var driver = new VlcDriver(new VlcStarter(MockRepository.GenerateMock<ILogger>())); TestUtilities.SetVlcExeLocationOnNonStandardWindowsEnvironments(driver); var jobArgument = string.Format("-I dummy \"{0}{2}NeedinYou2SecWavMp3128.mp3\" \":sout=#transcode{{vcodec=none,acodec=s16l,ab=128,channels=2,samplerate=44100}}:std{{dst='{1}{2}output.wav',access=file}}\" vlc://quit", TestUtilities.GetTestDir(), TestUtilities.GetTestOutputDir(), Path.DirectorySeparatorChar); Assert.IsFalse(File.Exists(Path.Combine(TestUtilities.GetTestOutputDir(), "output.wav"))); var instance = driver.StartInstance(jobArgument); var exitedNotificationHappened = false; instance.OnExited += (sender, e) => { exitedNotificationHappened = true; }; instance.Process.WaitForExit(); SleepToAllowEventHandler(); Assert.IsTrue(exitedNotificationHappened); var expectedFile = Path.Combine(TestUtilities.GetTestOutputDir(), "output.wav"); Assert.IsTrue(File.Exists(expectedFile)); var fileInfo = new FileInfo(expectedFile); Assert.That(fileInfo.Length, Is.EqualTo(368684).Within(AllowedOutputFileComparePercentage).Percent); }
public void TestVlcStarts() { var driver = new VlcDriver(new VlcStarter(MockRepository.GenerateMock<ILogger>())); TestUtilities.SetVlcExeLocationOnNonStandardWindowsEnvironments(driver); var instance = driver.StartInstance(); Thread.Sleep(500); var vlcProcesses = Process.GetProcessesByName("vlc"); Assert.AreEqual(1, vlcProcesses.Length); instance.Process.Kill(); instance.Process.WaitForExit(); vlcProcesses = Process.GetProcessesByName("vlc"); Assert.AreEqual(0, vlcProcesses.Length); }