public async Task GetFile_WhenTreeWithAppDesignerFolder_ReturnsPath(string input, string expected) { var tree = ProjectTreeParser.Parse(input); var treeProvider = new ProjectTreeProvider(); var physicalProjectTree = IPhysicalProjectTreeFactory.Create(provider: treeProvider, currentTree: tree); var provider = CreateInstance(physicalProjectTree); var result = await provider.GetFileAsync(SpecialFiles.AppDesigner, SpecialFileFlags.FullPath); Assert.Equal(expected, result); }
public async Task GetFile_WhenTreeWithAppDesignerFolder_ReturnsPathIfCreateIfNotExist() { var tree = ProjectTreeParser.Parse(@" Project (flags: {ProjectRoot}), FilePath: ""C:\Project\Project.csproj"" My Project (flags: {Folder AppDesignerFolder BubbleUp})"); var treeProvider = new ProjectTreeProvider(); var physicalProjectTree = IPhysicalProjectTreeFactory.Create(provider: treeProvider, currentTree: tree); var provider = CreateInstance(physicalProjectTree); var result = await provider.GetFileAsync(SpecialFiles.AppDesigner, SpecialFileFlags.CreateIfNotExist); Assert.Equal(@"C:\Project\My Project", result); }
public async Task GetFile_WhenTreeWithoutAppDesignerFolder_ReturnsDefaultAppDesignerFolder(string input, string expected) { var tree = ProjectTreeParser.Parse(@" Project (flags: {ProjectRoot}), FilePath: ""C:\Project\Project.csproj"" Properties (flags: {Folder}) "); var treeProvider = new ProjectTreeProvider(); var physicalProjectTree = IPhysicalProjectTreeFactory.Create(provider: treeProvider, currentTree: tree); var projectProperties = CreateProperties(appDesignerFolderName: input); var provider = CreateInstance(physicalProjectTree, projectProperties); var result = await provider.GetFileAsync(SpecialFiles.AppDesigner, SpecialFileFlags.FullPath); Assert.Equal(expected, result); }
public async Task GetFileAsync_WhenTreeWithFileSameName_ReturnsDefaultAppDesignerFolder() { var tree = ProjectTreeParser.Parse(@" Project (flags: {ProjectRoot}), FilePath: ""C:\Project\Project.csproj"" Properties (flags: {FileSystemEntity FileOnDisk}) "); var treeProvider = new ProjectTreeProvider(); var physicalProjectTree = IPhysicalProjectTreeFactory.Create(provider: treeProvider, currentTree: tree); var projectProperties = CreateProperties(appDesignerFolderName: "Properties"); var provider = CreateInstance(physicalProjectTree, projectProperties); var result = await provider.GetFileAsync(SpecialFiles.AppDesigner, SpecialFileFlags.FullPath); Assert.Equal(@"C:\Project\Properties", result); }
public async Task GetFileAsync_WhenTreeWithFileSameName_ThrowsIfCreateIfNotExist() { var tree = ProjectTreeParser.Parse(@" Project (flags: {ProjectRoot}), FilePath: ""C:\Project\Project.csproj"" Properties (flags: {FileSystemEntity FileOnDisk}), FilePath: ""C:\Project\Properties"" "); var treeProvider = new ProjectTreeProvider(); var physicalProjectTree = IPhysicalProjectTreeFactory.Create(provider: treeProvider, currentTree: tree); var projectProperties = CreateProperties(appDesignerFolderName: "Properties"); var provider = CreateInstance(physicalProjectTree, projectProperties); await Assert.ThrowsAsync <IOException>(() => { return(provider.GetFileAsync(SpecialFiles.AppDesigner, SpecialFileFlags.CreateIfNotExist)); }); }