Beispiel #1
0
        public void HashGeneratorUsesAlgorithmToComputeHashGivenByteArray()
        {
            // Arrange
            const string input = "Foo Bar Baz";
            const string expected = "759aef3d77fbc8e6114ea17e9283adff3d987195";
            HashGenerator gen = new HashGenerator(new SHA1Managed());

            // Act
            string actual = gen.HashData(Encoding.ASCII.GetBytes(input));

            // Assert
            Assert.Equal(expected, actual);
        }
Beispiel #2
0
 public Database(HashGenerator hashGenerator, IReferenceDirectory directory, IPersistentDictionary storage, IObjectCodec codec, IPackedObjectDatabase packedObjects)
 {
     if (hashGenerator == null) { throw new ArgumentNullException("hashAlgorithm"); }
     if (directory == null) { throw new ArgumentNullException("directory"); }
     if (storage == null) { throw new ArgumentNullException("storage"); }
     if (codec == null) { throw new ArgumentNullException("codec"); }
     if (packedObjects == null) { throw new ArgumentNullException("packedObjects"); }
     HashGenerator = hashGenerator;
     Directory = directory;
     Storage = storage;
     Codec = codec;
     PackedObjects = packedObjects;
 }