public void TestSecurityExtension() { //Act //MockIPrincipal var result = SecurityExtensions.HashedAccountId(MockClaimsIdentity.Object); //Assert Assert.IsNotNull(result); }
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); }
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); }