예제 #1
0
        public void TheHexRepresentation_IsHexadecimalRepresentation_OfBytes()
        {
            var bytes = new byte[] { 0, 1, 2, 3, 4 };
            var expectedRepresentation = BitConverter.ToString(bytes).Replace("-", "");

            var hashMock          = Mock.Of <IHash>(m => m.Bytes == bytes);
            var hexRepresentation = HashStringRepresentation.Process(hashMock);

            Check.That(hexRepresentation).Equals(expectedRepresentation);
        }
예제 #2
0
        public void AHash_StringRepresentation_ReturnsHashHexadecimalRepresentation_Value()
        {
            var inputStream = new MemoryStream(new byte[] { 0, 1, 2, 3, 4 });

            var hash = new Mock <StreamHash>(
                inputStream,
                Mock.Of <THashAlgorithm>())
            {
                CallBase = true
            }.Object;

            var expectedRepresentation = HashStringRepresentation.Process(hash);

            Check.That(hash.ToString()).Equals(expectedRepresentation);
        }