public void GetFileInfo_ReturnsNotFoundFileInfo_IfFileDoesNotExist()
        {
            // Arrange
            var provider = new CompositeFileProvider(new MockFileProvider(new MockFileInfo("DoesExist.txt")));

            // Act
            var fileInfo = provider.GetFileInfo("DoesNotExist.txt");

            // Assert
            Assert.NotNull(fileInfo);
            Assert.False(fileInfo.Exists);
        }
        public void GetFileInfo_ReturnsNotFoundFileInfo_IfFileDoesNotExist()
        {
            // Arrange
            var provider = new CompositeFileProvider(new MockFileProvider(new MockFileInfo("DoesExist.txt")));

            // Act
            var fileInfo = provider.GetFileInfo("DoesNotExist.txt");

            // Assert
            Assert.NotNull(fileInfo);
            Assert.False(fileInfo.Exists);
        }
        public void GetFileInfo_ReturnsTheFirstFoundFileInfo()
        {
            // Arrange
            var fileName         = "File1";
            var expectedFileInfo = new MockFileInfo(fileName);
            var provider         = new CompositeFileProvider(
                new MockFileProvider(
                    new MockFileInfo("FileA"),
                    new MockFileInfo("FileB")),
                new MockFileProvider(
                    expectedFileInfo,
                    new MockFileInfo("File2")),
                new MockFileProvider(
                    new MockFileInfo(fileName),
                    new MockFileInfo("File3")));

            // Act
            var fileInfo = provider.GetFileInfo(fileName);

            // Assert
            Assert.Same(expectedFileInfo, fileInfo);
        }
        public void GetFileInfo_ReturnsTheFirstFoundFileInfo()
        {
            // Arrange
            var fileName = "File1";
            var expectedFileInfo = new MockFileInfo(fileName);
            var provider = new CompositeFileProvider(
                new MockFileProvider(
                    new MockFileInfo("FileA"),
                    new MockFileInfo("FileB")),
                new MockFileProvider(
                    expectedFileInfo,
                    new MockFileInfo("File2")),
                new MockFileProvider(
                    new MockFileInfo(fileName),
                    new MockFileInfo("File3")));

            // Act
            var fileInfo = provider.GetFileInfo(fileName);

            // Assert
            Assert.Same(expectedFileInfo, fileInfo);
        }
示例#5
0
 public IFileInfo GetFileInfo(string subpath)
 => _fileProvider.GetFileInfo(subpath);