public void ResolveReferenceWithHash()
        {
            // Arrange
            InMemoryFileSystem fs = new InMemoryFileSystem();
            GitReferenceDirectory refs = new GitReferenceDirectory(fs);

            // Assume
            Assert.False(fs.Exists("abcdefghij"));

            // Act/Assert
            Assert.Equal("abcdefghij", refs.ResolveReference("abcdefghij"));
        }
        public void ExistsReturnsFalseIfHashFileDoesNotExist()
        {
            // Arrange
            InMemoryFileSystem      fs = new InMemoryFileSystem();
            GitLooseFilesDictionary db = new GitLooseFilesDictionary(fs, new NullCompressionStrategy());

            // Assume
            Assert.False(fs.Exists(@"ab\cdefghijk"));

            // Act/Assert
            Assert.False(db.Exists("abcdefghijk"));
        }
        public void ExistsReturnsFalseIfHashFileDoesNotExist()
        {
            // Arrange
            InMemoryFileSystem fs = new InMemoryFileSystem();
            GitLooseFilesDictionary db = new GitLooseFilesDictionary(fs, new NullCompressionStrategy());

            // Assume
            Assert.False(fs.Exists(@"ab\cdefghijk"));

            // Act/Assert
            Assert.False(db.Exists("abcdefghijk"));
        }
        public void ResolveReferenceWithHash()
        {
            // Arrange
            InMemoryFileSystem    fs   = new InMemoryFileSystem();
            GitReferenceDirectory refs = new GitReferenceDirectory(fs);

            // Assume
            Assert.False(fs.Exists("abcdefghij"));

            // Act/Assert
            Assert.Equal("abcdefghij", refs.ResolveReference("abcdefghij"));
        }
        public void OpenNonExistantKeyForWriteWithCreateCreatesNewData()
        {
            // Arrange
            InMemoryFileSystem      fs = new InMemoryFileSystem();
            GitLooseFilesDictionary db = new GitLooseFilesDictionary(fs, new NullCompressionStrategy());

            // Assume
            Assert.False(fs.Exists(@"ab\cdefghijk"));

            // Act
            using (Stream strm = db.OpenWrite("abcdefghijk", create: true))
                using (StreamWriter writer = new StreamWriter(strm))
                {
                    writer.Write("FooBarBaz");
                }

            // Assert
            Assert.Equal("FooBarBaz", fs.ReadTestFile(@"ab\cdefghijk"));
        }
        public void OpenNonExistantKeyForWriteWithCreateCreatesNewData()
        {
            // Arrange
            InMemoryFileSystem fs = new InMemoryFileSystem();
            GitLooseFilesDictionary db = new GitLooseFilesDictionary(fs, new NullCompressionStrategy());

            // Assume
            Assert.False(fs.Exists(@"ab\cdefghijk"));

            // Act
            using (Stream strm = db.OpenWrite("abcdefghijk", create: true))
            using(StreamWriter writer = new StreamWriter(strm))
            {
                writer.Write("FooBarBaz");
            }

            // Assert
            Assert.Equal("FooBarBaz", fs.ReadTestFile(@"ab\cdefghijk"));
        }