コード例 #1
0
        public void ValidateEmailToken()
        {
            if (_member == null)
            {
                Assert.Fail("ValidateEmailToken: Test failed to create new member.");
            }

            var result = MemberSvc.ValidateEmail(_member.Id, _memberOptions.EmailToken);

            Assert.AreEqual(true, result.IsSuccess);
        }
コード例 #2
0
        public void InvalidEmailToken()
        {
            if (_member == null)
            {
                Assert.Fail("InvalidEmailToken: Test failed to create new member.");
            }

            string token  = Guid.NewGuid().ToString();
            var    result = MemberSvc.ValidateEmail(_member.Id, token);

            Assert.AreEqual(false, result.IsSuccess);
        }
コード例 #3
0
        public void InvalidResetPassword()
        {
            if (_member == null)
            {
                Assert.Fail("InvalidResetPassword: Test failed to create new member.");
            }

            var jsnToken = new
            {
                Token  = Guid.NewGuid().ToString(),
                Expire = DateTime.UtcNow.AddHours(5)
            };

            string stringToken = JsonConvert.SerializeObject(jsnToken);

            stringToken = Cryptography.Encrypt(stringToken, _member.CryptoKey);
            stringToken = Cryptography.EncryptToUrlFriendly(stringToken);
            var result = MemberSvc.ValidateEmail(_member.Id, stringToken);

            Assert.AreEqual(false, result.IsSuccess);
        }