Пример #1
0
        public void TestSecurityExtension()
        {
            //Act
            //MockIPrincipal
            var result = SecurityExtensions.HashedAccountId(MockClaimsIdentity.Object);

            //Assert
            Assert.IsNotNull(result);
        }
Пример #2
0
        public void HashedAccountId_WhenClaimsSetWithHashedAccountId_ThenReturnHashedAccountId()
        {
            //Arrange
            claims.Add(new Claim(RouteValueKeys.AccountHashedId, HashedAccountId));
            mockClaimsIdentity.Setup(m => m.Claims).Returns(claims);

            //Act
            var result = SecurityExtensions.HashedAccountId(mockClaimsIdentity.Object);

            //Assert
            Assert.AreEqual(HashedAccountId, result);
        }
Пример #3
0
        public void HashedAccountId_WhenClaimsNotSetWithHashedAccountId_ThenReturnHashedAccountIdAsEmptyString()
        {
            //Arrange
            List <Claim> claims = new List <Claim>();

            mockClaimsIdentity.Setup(m => m.Claims).Returns(claims);

            //Act
            var result = SecurityExtensions.HashedAccountId(mockClaimsIdentity.Object);

            //Assert
            Assert.AreEqual(string.Empty, result);
        }