Inheritance: IQrCodeProvider
        public void GetQrCodeImageAsDataUriThrowsOnInvalidSize()
        {
            var qr     = new TestQrProvider();
            var target = new TwoFactorAuth(qrcodeprovider: qr);

            target.GetQrCodeImageAsDataUri("Test", "VMR466AB62ZBOKHE", 0);
        }
Ejemplo n.º 2
0
        public void GetQrCodeImageAsDataUriThrowsOnInvalidSize()
        {
            var qr     = new TestQrProvider();
            var target = new TwoFactorAuth(null, 6, 30, Algorithm.SHA1, qr);

            target.GetQrCodeImageAsDataUri("Test", "VMR466AB62ZBOKHE", 0);
        }
        public void VerifyTotpUriIsCorrect()
        {
            var qr     = new TestQrProvider();
            var target = new TwoFactorAuth(issuer: "Test&Issuer", qrcodeprovider: qr);

            var data = DecodeDataUri(target.GetQrCodeImageAsDataUri("Test&Label", "VMR466AB62ZBOKHE"));

            Assert.AreEqual("test/test", data["mimetype"]);
            Assert.AreEqual("base64", data["encoding"]);
            Assert.AreEqual("otpauth://totp/Test%26Label?secret=VMR466AB62ZBOKHE&issuer=Test%26Issuer&period=30&algorithm=SHA1&digits=6@200", data["data"]);
        }
        public void GetQrCodeImageAsDataUriThrowsOnInvalidSize()
        {
            var qr = new TestQrProvider();
            var target = new TwoFactorAuth(null, 6, 30, Algorithm.SHA1, qr);

            target.GetQrCodeImageAsDataUri("Test", "VMR466AB62ZBOKHE", 0);
        }
        public void VerifyTotpUriIsCorrect()
        {
            var qr = new TestQrProvider();
            var target = new TwoFactorAuth("Test&Issuer", 6, 30, Algorithm.SHA1, qr);

            var data = DecodeDataUri(target.GetQrCodeImageAsDataUri("Test&Label", "VMR466AB62ZBOKHE"));
            Assert.AreEqual("test/test", data["mimetype"]);
            Assert.AreEqual("base64", data["encoding"]);
            Assert.AreEqual("otpauth://totp/Test%26Label?secret=VMR466AB62ZBOKHE&issuer=Test%26Issuer&period=30&algorithm=SHA1&digits=6@200", data["data"]);
        }