public async Task GetFileAsync_WhenNoAppDesigner_ReturnsPathUnderAppDesigner()
        {
            var tree = ProjectTreeParser.Parse($@"
Project (flags: {{ProjectRoot}}), FilePath: ""C:\Project\Project.csproj""
");
            var specialFilesManager = ISpecialFilesManagerFactory.ImplementGetFile(@"C:\Project\Properties");
            var provider            = CreateInstance(specialFilesManager, tree);

            var result = await provider.GetFileAsync(0, SpecialFileFlags.FullPath);

            Assert.Equal($@"C:\Project\Properties\{_fileName}", result);
        }
        public async Task GetFileAsync_WhenRootWithFile_ReturnsPath()
        {
            var tree = ProjectTreeParser.Parse($@"
Project (flags: {{ProjectRoot}}), FilePath: ""C:\Project\Project.csproj""
    {_fileName} (flags: {{FileSystemEntity FileOnDisk}}), FilePath: ""C:\Project\{_fileName}""
");
            var specialFilesManager = ISpecialFilesManagerFactory.ImplementGetFile(null);

            var provider = CreateInstance(specialFilesManager, tree);

            var result = await provider.GetFileAsync(0, SpecialFileFlags.FullPath);

            Assert.Equal($@"C:\Project\{_fileName}", result);
        }
        public async Task GetFileAsync_WhenTreeWithExistentFile_ReturnsPathIfCreateIfNotExist()
        {
            var tree = ProjectTreeParser.Parse($@"
Project (flags: {{ProjectRoot}}), FilePath: ""C:\Project\Project.csproj""
    {_fileName} (flags: {{FileSystemEntity FileOnDisk}}), FilePath: ""C:\Project\{_fileName}""
");
            var physicalProjectTree = IPhysicalProjectTreeFactory.Create(currentTree: tree);
            var specialFilesManager = ISpecialFilesManagerFactory.ImplementGetFile(null);
            var provider            = CreateInstance(specialFilesManager, physicalProjectTree);

            string?result = await provider.GetFileAsync(0, SpecialFileFlags.CreateIfNotExist);

            Assert.Equal($@"C:\Project\{_fileName}", result);
        }
        public async Task GetFileAsync_WhenTreeWithFolderSameName_ThrowsIfCreateIfNotExist()
        {
            var tree = ProjectTreeParser.Parse($@"
Project (flags: {{ProjectRoot}}), FilePath: ""C:\Project\Project.csproj""
    {_fileName} (flags: {{FileSystemEntity Folder}}), FilePath: ""C:\Project\{_fileName}""
");

            var specialFilesManager = ISpecialFilesManagerFactory.ImplementGetFile(null);
            var provider            = CreateInstance(specialFilesManager, tree);

            await Assert.ThrowsAsync <IOException>(() =>
            {
                return(provider.GetFileAsync(0, SpecialFileFlags.CreateIfNotExist));
            });
        }
        public async Task GetFileAsync_WhenTreeWithMissingFile_IsCreatedIfCreateIfNotExist()
        {
            var tree                = ProjectTreeParser.Parse($@"
Project (flags: {{ProjectRoot}}), FilePath: ""C:\Project\Project.csproj""
    {_fileName} (flags: {{}}), FilePath: ""C:\Project\{_fileName}""
");
            int callCount           = 0;
            var storage             = IPhysicalProjectTreeStorageFactory.ImplementCreateEmptyFileAsync(path => callCount++);
            var specialFilesManager = ISpecialFilesManagerFactory.ImplementGetFile(null);
            var physicalProjectTree = IPhysicalProjectTreeFactory.Create(currentTree: tree, storage: storage);
            var provider            = CreateInstance(specialFilesManager, physicalProjectTree);

            await provider.GetFileAsync(0, SpecialFileFlags.CreateIfNotExist);

            Assert.Equal(1, callCount);
        }