Esempio n. 1
0
            public void WhenNullOrEmptyText_ExpectNoQrCode(string text)
            {
                // arrange
                var sut = new BarCodes();
                //act
                var actual = sut.With_Text(text)
                             .With_Default_Resolution()
                             .With_Default_Dimension()
                             .Of_Type_QR_Code(true)
                             .As_Png()
                             .Create();

                // assert
                actual.Length.Should().Be(0);
            }
Esempio n. 2
0
            public void WhenResponseNotNull_ExpectQrCode()
            {
                // arrange
                var text = Guid.NewGuid().ToString();
                var sut  = new BarCodes();
                // act
                var actual = sut.With_Text(text)
                             .With_Default_Resolution()
                             .With_Default_Dimension()
                             .Of_Type_QR_Code(true)
                             .As_Png()
                             .Create();

                // assert
                actual.Length.Should().BeGreaterThan(0);
            }
Esempio n. 3
0
            public void WhenResponseNotNull_ExpectQrCodeSavedToFileSystem()
            {
                // arrange
                var localPath = Path.GetTempFileName() + ".png";
                var text      = Guid.NewGuid().ToString();
                var sut       = new BarCodes();

                // act
                sut.With_Text(text)
                .With_Default_Resolution()
                .With_Default_Dimension()
                .Of_Type_QR_Code(true)
                .As_Png()
                .Save_To(localPath);
                var qrCodeBytes = File.ReadAllBytes(localPath);

                // assert
                qrCodeBytes.Length.Should().BeGreaterThan(0);
            }