Git.Core.FileSystem.DeleteRepository C# (CSharp) Method

DeleteRepository() public method

public DeleteRepository ( string name ) : bool
name string
return bool
        public bool DeleteRepository(string name)
        {
            var fullPath = String.Format(@"{0}\{1}.git", _base, name);

            if (Directory.Exists(fullPath))
            {
                Directory.Delete(fullPath, true);
                return true;
            }

            return false;
        }

Usage Example

Example #1
0
        public void FileSystemDelete()
        {
            var fileSystem = new FileSystem(@"c:\temp\");
            int[] threadCount = { 0 };

            for (var i = 0; i < RepositoryCount; ++i)
            {
                int i1 = i;
                new TestDelegate(() => Assert.True(fileSystem.DeleteRepository(string.Format("repo_{0}", i1)))).BeginInvoke(
                    delegate {
                            Interlocked.Increment(ref threadCount[0]);
                            Assert.IsNull(fileSystem[string.Format("repo_{0}", i1)]);
                        }, null);
            }

            while (threadCount[0] != RepositoryCount)
            {
                Thread.Sleep(3000);
            }
        }