コード例 #1
0
        async Task ShouldBeAbleToEmbedAndExtractMessage(string imageName, string message)
        {
            var outputPath = $"{Environment.CurrentDirectory}/embedded-{imageName}";

            _output.WriteLine(outputPath);

            using var image = await Image.LoadAsync <Rgba32>($"resources/images/{imageName}");

            _sut.EmbedMessage(image, message);

            await image.SaveAsStegoAsync(outputPath);

            using var imageWithPayload = await Image.LoadAsync <Rgba32>(outputPath);

            var actualMessage = _sut.ExtractMessage(imageWithPayload);

            actualMessage.Should().Be(message);
        }
コード例 #2
0
 public long ExtractMessage()
 {
     return(_steganographer.ExtractMessage(_imageWithMessage).Length);
 }