public void It_should_empty_array_directory_not_found() { // Arrange var cacheService = new Mock <IFileCacheService>(); var ioProxy = new Mock <IIOProxy>(); ioProxy.Setup(x => x.DirectoryExists(SLASH_MD)).Returns(false); var service = new FileFetcherService(_options.Object, _logger.Object, ioProxy.Object, cacheService.Object); // Act string[] actual = service.GetFileNames(); // Assert Assert.Equal(0, actual.Length); }
public void It_should_get_files_names_without_extensions() { // Arrange var ioProxy = new Mock <IIOProxy>(); ioProxy.Setup(x => x.GetFiles(SLASH_MD)).Returns(new[] { "test.md", "other.md" }); ioProxy.Setup(x => x.DirectoryExists(SLASH_MD)).Returns(true); var cacheService = new Mock <IFileCacheService>(); var service = new FileFetcherService(_options.Object, _logger.Object, ioProxy.Object, cacheService.Object); // Act string[] actual = service.GetFileNames().ToArray(); // Assert Assert.Equal("test", actual[0]); Assert.Equal("other", actual[1]); }
public void It_should_return_empty_array_directory_null() { // Arrange var badOptions = new Mock <IOptions <MdFileOptions> >(); badOptions.SetupGet(x => x.Value).Returns(new MdFileOptions { MDSSourceDirectory = null }); var cacheService = new Mock <IFileCacheService>(); var ioProxy = new Mock <IIOProxy>(); var service = new FileFetcherService(badOptions.Object, _logger.Object, ioProxy.Object, cacheService.Object); // Act string[] actual = service.GetFileNames(); // Assert Assert.Equal(0, actual.Length); }