public async Task FindFile_FromRoot(string input, string expectedFilePath) { var inputTree = ProjectTreeParser.Parse(input); var projectTreeService = IProjectTreeServiceFactory.Create(inputTree); var sourceItemsProvider = IProjectItemProviderFactory.Create(); var fileSystem = IFileSystemFactory.Create(path => true); var provider = new AppConfigFileSpecialFileProvider(projectTreeService, sourceItemsProvider, null, fileSystem); var filePath = await provider.GetFileAsync(SpecialFiles.AppConfig, SpecialFileFlags.FullPath); Assert.Equal(expectedFilePath, filePath); }
public async Task CreateFile_InRootFolder(string input, string expected, string expectedFilePath) { var inputTree = ProjectTreeParser.Parse(input); var expectedTree = ProjectTreeParser.Parse(expected); var projectTreeService = IProjectTreeServiceFactory.Create(inputTree); var sourceItemsProvider = IProjectItemProviderFactory.CreateWithAdd(inputTree); var fileSystem = IFileSystemFactory.Create(path => false, path => { // Verify that file is created on disk. Assert.Equal(expectedFilePath, path); return(null); }); var provider = new AppConfigFileSpecialFileProvider(projectTreeService, sourceItemsProvider, null, fileSystem); var filePath = await provider.GetFileAsync(SpecialFiles.AppConfig, SpecialFileFlags.CreateIfNotExist); Assert.Equal(expectedFilePath, filePath); AssertAreEquivalent(expectedTree, inputTree); }