static void Main(string[] args) { ILog log = new ConsoleLog(); IFileSystem fileSystem = new FileSystem(); IMediaRepository repository = new DbMediaRepository(new EntityFrameworkSexContext()); IMediaFactory extractor = new MediaInfoDotNetMediaFactory(); IFileSystemObserver observer = new FileSystemObserver(@"\\Etrayz\public\Video\Otros"); MediaWatcher watcher = new MediaWatcher(fileSystem, repository, extractor, observer, log); watcher.Synchronize(@"\\Etrayz\public\Video\Otros"); watcher.Watch(); }
public void TestMethod1() { ILog log = new ConsoleLog(); IFileSystem fileSystem = new FileSystem(); IMediaRepository repository = new MemoryMediaRepository(); IMediaFactory extractor = new MediaInfoDotNetMediaFactory(); IFileSystemObserver observer = new FileSystemObserver(@"\\Etrayz\public\Video\Otros"); MediaWatcher watcher = new MediaWatcher(fileSystem, repository, extractor, observer, log); watcher.Synchronize(@"\\Etrayz\public\Video\Otros"); Assert.IsTrue(repository.ContainsFile("")); }
public void GivenExistingFiles_GetsThemIntoRepository() { const string audioFileName = "video.mp3"; const string videoFileName = "video.mp4"; ILog log = new ConsoleLog(); IFileSystem fileSystem = new FakeFileSystem(); IMediaRepository repository = new MemoryMediaRepository(); IMediaFactory extractor = A.Fake <IMediaFactory>(); A.CallTo(() => extractor.BuildFromFile(audioFileName)).Returns(new NonMedia()); A.CallTo(() => extractor.BuildFromFile(videoFileName)).Returns(new Video(videoFileName, 340, TimeSpan.Zero, 640, 320)); IFileSystemObserver observer = new FakeFileSystemObserver(fileSystem); MediaWatcher mediaWatcher = new MediaWatcher(fileSystem, repository, extractor, observer, log); fileSystem.File.Create(audioFileName); fileSystem.File.Create(videoFileName); mediaWatcher.Synchronize(@""); Assert.IsTrue(repository.ContainsFile(videoFileName)); }