public async Task CreateFile_NotInSync(string input, string expected, bool fileExistsOnDisk, string expectedFilePath)
        {
            var inputTree    = ProjectTreeParser.Parse(input);
            var expectedTree = ProjectTreeParser.Parse(expected);

            var projectTreeProvider = new ProjectTreeProvider();
            var projectTree         = IPhysicalProjectTreeFactory.Create(provider: projectTreeProvider, currentTree: inputTree);
            var sourceItemsProvider = IProjectItemProviderFactory.CreateWithAdd(inputTree);
            var fileSystem          = IFileSystemFactory.Create(path => fileExistsOnDisk,
                                                                path =>
            {
                // Verify that file is created on disk.
                Assert.False(fileExistsOnDisk);
                Assert.Equal(expectedFilePath, path);
                return(null);
            });

            var specialFilesManager = ISpecialFilesManagerFactory.ImplementGetFile(@"C:\Foo\Properties");

            var provider = new SettingsFileSpecialFileProvider(projectTree, sourceItemsProvider, null, fileSystem, specialFilesManager);
            var filePath = await provider.GetFileAsync(SpecialFiles.AppSettings, SpecialFileFlags.CreateIfNotExist);

            Assert.Equal(expectedFilePath, filePath);
            AssertAreEquivalent(expectedTree, inputTree);
        }
        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);
        }
        public async Task CreateFile_CallTemplateProvider(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.False(true, "File system create shouldn't have been called directly.");
                return(null);
            });
            var templateProvider = new Lazy <ICreateFileFromTemplateService>(() => ICreateFileFromTemplateServiceFactory.Create());

            var provider = new SettingsFileSpecialFileProvider(projectTreeService, sourceItemsProvider, templateProvider, fileSystem);
            var filePath = await provider.GetFileAsync(SpecialFiles.AppSettings, SpecialFileFlags.CreateIfNotExist);

            Assert.Equal(expectedFilePath, filePath);
            AssertAreEquivalent(expectedTree, inputTree);
        }