Inheritance: IFileSystem
        public void DirectoryExistsShouldReturnTrueWithDeepPath()
        {
            var fileSystem = new FakeFileSystem(@"C:\temp\repo");
            fileSystem.Files.Add(@"dir1\dir2\dir3\dir4\file1.txt");

            Assert.True(fileSystem.DirectoryExists(@"dir1\dir2\dir3"));
        }
        public ExtensionManagerTests()
        {
            resharperApi = new FakeReSharperApi(Version.Parse("6.0.0.0"));

            localRepository = new FakePackageRepository(RepoPath);
            fileSystem = new FakeFileSystem(RepoPath);
            var pathResolver = new DefaultPackagePathResolver(fileSystem);
            packageManager = new PackageManager(new AggregateRepository(Enumerable.Empty<IPackageRepository>()), pathResolver, fileSystem, localRepository);
            manager = new ExtensionManager.Implementation.ExtensionManager(resharperApi, null, packageManager);
        }
        public void FileExistsShouldReturnTrueIfFileExistsCaseInsensitive()
        {
            var fileSystem = new FakeFileSystem(@"C:\\temp\\repo\");
            fileSystem.Files.Add("Matt\\file1.txt");
            fileSystem.Files.Add("Matt\\file2.txt");
            fileSystem.Files.Add("Matt\\file3.txt");
            fileSystem.Files.Add("Matt2\\file3.txt");

            Assert.True(fileSystem.FileExists("MATT\\FILE1.txt"));
        }
        public void FileExistsShouldReturnFalseIfFileDoesNotExist()
        {
            var fileSystem = new FakeFileSystem(@"C:\temp\repo");
            fileSystem.Files.Add("Matt\\file1.txt");
            fileSystem.Files.Add("Matt\\file2.txt");
            fileSystem.Files.Add("Matt\\file3.txt");
            fileSystem.Files.Add("Matt2\\file3.txt");

            Assert.False(fileSystem.FileExists("Matt2\\file1.txt"));
        }
        public void DirectoryExistsShouldReturnTrueIfExistsCaseInsensitive()
        {
            var fileSystem = new FakeFileSystem(@"C:\temp\repo");
            fileSystem.Files.Add("Matt\\file1.txt");
            fileSystem.Files.Add("Matt\\file2.txt");
            fileSystem.Files.Add("Matt\\file3.txt");
            fileSystem.Files.Add("Matt2\\file3.txt");

            Assert.True(fileSystem.DirectoryExists("MATT"));
        }
        public void ShouldDeleteFile()
        {
            var fileSystem = new FakeFileSystem(@"C:\temp\repo");
            fileSystem.Files.Add("Matt\\file1.txt");
            fileSystem.Files.Add("Matt\\file2.txt");
            fileSystem.Files.Add("Matt\\file3.txt");
            fileSystem.Files.Add("Matt2\\file3.txt");

            fileSystem.DeleteFile("Matt\\file2.txt");

            Assert.Equal(3, fileSystem.Files.Count);
            Assert.Contains("Matt\\file1.txt", fileSystem.Files);
            Assert.Contains("Matt\\file3.txt", fileSystem.Files);
            Assert.Contains("Matt2\\file3.txt", fileSystem.Files);
            Assert.DoesNotContain("Matt\\file2.txt", fileSystem.Files);
        }
        public void ShouldGetDirectoriesAtRootLevel()
        {
            var fileSystem = new FakeFileSystem(@"C:\temp\repo");
            fileSystem.Files.Add("Matt\\file1.txt");
            fileSystem.Files.Add("Matt\\file2.txt");
            fileSystem.Files.Add("Matt\\file3.txt");
            fileSystem.Files.Add("Matt2\\file3.txt");

            var directories = fileSystem.GetDirectories(string.Empty).ToList();

            Assert.Equal(2, directories.Count);
            Assert.Equal(new[] { "Matt", "Matt2" }, directories.ToArray());
        }
        public void ShouldDeleteOnlyFilesInDirectory()
        {
            var fileSystem = new FakeFileSystem(@"C:\temp\repo");
            fileSystem.Files.Add("Matt\\file1.txt");
            fileSystem.Files.Add("Matt\\file2.txt");
            fileSystem.Files.Add("Matt\\file3.txt");
            fileSystem.Files.Add("Matt2\\file3.txt");

            fileSystem.DeleteDirectory("Matt", true);

            Assert.Equal(1, fileSystem.Files.Count);
            Assert.Equal("Matt2\\file3.txt", fileSystem.Files.First());
        }