public void ShouldComputeCorrectDigest(string algorithmIdentifier, string content, string expectedDigest)
        {
            using var stream = new MemoryStream();

            // make sure we write without BOM
            using var writer = new StreamWriter(stream, encoding: new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), leaveOpen: true);
            writer.Write(content);

            // the write is buffered, so we actually see it
            writer.Flush();

            // reset for reading
            stream.Position = 0;

            var actual = DescriptorFactory.ComputeDigest(algorithmIdentifier, stream);

            actual.Should().Be(expectedDigest);
        }
        public void UnknownAlgorithmShouldThrow()
        {
            Action fail = () => DescriptorFactory.ComputeDigest("fake", Stream.Null);

            fail.Should().Throw <NotImplementedException>().WithMessage("Unknown hash algorithm 'fake'.");
        }