GetApplicationFilePaths() public method

public GetApplicationFilePaths ( string buildFolder ) : NuDeploy.Core.Services.Filesystem.RelativeFilePathInfo[]
buildFolder string
return NuDeploy.Core.Services.Filesystem.RelativeFilePathInfo[]
        public void GetApplicationFilePaths_FolderDoesNotExist_ResultIsEmptyList()
        {
            // Arrange
            string buildFolder = Path.GetFullPath("build-folder");

            var filesystemAccessor = new Mock<IFilesystemAccessor>();
            filesystemAccessor.Setup(f => f.DirectoryExists(It.Is<string>(s => s.StartsWith(buildFolder)))).Returns(false);

            var relativeFilePathInfoFactory = new Mock<IRelativeFilePathInfoFactory>();

            var buildResultFilePathProvider = new ConventionBasedBuildResultFilePathProvider(filesystemAccessor.Object, relativeFilePathInfoFactory.Object);

            // Act
            var result = buildResultFilePathProvider.GetApplicationFilePaths(buildFolder);

            // Assert
            Assert.AreEqual(0, result.Length);
        }
        public void GetApplicationFilePaths_FolderExist_ContainsOneApplication_ResultCountEqualsFileCount_GetRelativeFilePathInfoIsCalledForEachFile()
        {
            // Arrange
            string buildFolder = Path.GetFullPath("build-folder");

            string applicationPath = Path.Combine(buildFolder, ConventionBasedBuildResultFilePathProvider.FolderNamePublishedApplications, "Test.App.1");

            var files = new List<FileInfo>
                {
                    new FileInfo(Path.Combine(applicationPath, "file1.txt")),
                    new FileInfo(Path.Combine(applicationPath, "file2.txt")),
                };

            var filesystemAccessor = new Mock<IFilesystemAccessor>();
            filesystemAccessor.Setup(f => f.DirectoryExists(It.Is<string>(s => s.StartsWith(buildFolder)))).Returns(true);
            filesystemAccessor.Setup(f => f.GetAllFiles(It.Is<string>(s => s.StartsWith(buildFolder)))).Returns(files);

            var relativeFilePathInfoFactory = new Mock<IRelativeFilePathInfoFactory>();

            var buildResultFilePathProvider = new ConventionBasedBuildResultFilePathProvider(filesystemAccessor.Object, relativeFilePathInfoFactory.Object);

            // Act
            var result = buildResultFilePathProvider.GetApplicationFilePaths(buildFolder);

            // Assert
            Assert.AreEqual(files.Count, result.Length);
            foreach (var websiteFile in files)
            {
                string absolutePath = websiteFile.FullName;
                relativeFilePathInfoFactory.Verify(r => r.GetRelativeFilePathInfo(absolutePath, It.IsAny<string>()), Times.Once());
            }
        }