Skip to content

Commit 16d4abe

Browse files
committed
Create SvgQRCodeRendererTests.cs
1 parent f1a12e5 commit 16d4abe

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System;
2+
using Xunit;
3+
using QRCoder;
4+
using Shouldly;
5+
using QRCoderTests.XUnitExtenstions;
6+
using System.IO;
7+
using System.Security.Cryptography;
8+
#if !NETCOREAPP1_1
9+
using System.Drawing;
10+
#endif
11+
12+
namespace QRCoderTests
13+
{
14+
15+
public class SvgQRCodeRendererTests
16+
{
17+
18+
19+
#if !NETCOREAPP1_1 && !NETCOREAPP2_0
20+
21+
[Fact]
22+
[Category("QRRenderer/QRCode")]
23+
public void can_create_qrcode_with_transparent_logo_graphic()
24+
{
25+
//Create QR code
26+
var gen = new QRCodeGenerator();
27+
var data = gen.CreateQrCode("This is a quick test! 123#?", QRCodeGenerator.ECCLevel.H);
28+
var svg = new SvgQRCode(data).GetGraphic(10, Color.Red, Color.White);
29+
30+
var md5 = new MD5CryptoServiceProvider();
31+
var hash = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(svg));
32+
var result = BitConverter.ToString(hash).Replace("-", "").ToLower();
33+
34+
result.ShouldBe("0ad8bc75675d04ba0caff51c7a89992c");
35+
}
36+
#endif
37+
}
38+
}
39+
40+
41+

0 commit comments

Comments
 (0)