public void TestSetUserId_NoClaims_ShouldNotThrowAnyExceptions() { var claims = new List <Claim>(); var claimsPrincipal = new ClaimsPrincipal(); var user = new WebApiUser(claimsPrincipal); Assert.AreEqual(Guid.Empty, user.Id); user.Invoking(x => x.SetUserId(claims)).ShouldNotThrow(); }
public void TestSetTokenExpirationDate_InvalidTime() { var claims = new List <Claim>(); claims.Add(new Claim(WebApiUser.EXPIRATION_DATE_KEY, "abc")); var claimsPrincipal = new ClaimsPrincipal(); var user = new WebApiUser(claimsPrincipal); user.Invoking(x => x.SetTokenExpirationDate(claims)).ShouldNotThrow(); }
public void TestSetTokenValidAfterDate_InvalidTime() { var claims = new List <Claim>(); claims.Add(new Claim(WebApiUser.VALID_NOT_BEFORE_DATE_KEY, "abc")); var claimsPrincipal = new ClaimsPrincipal(); var user = new WebApiUser(claimsPrincipal); user.Invoking(x => x.SetTokenValidAfterDate(claims)).ShouldNotThrow(); }
public void TestSetTokenIssueDate_InvalidTime() { var claims = new List <Claim>(); claims.Add(new Claim(WebApiUser.ISSUED_AT_TIME_KEY, "abc")); var claimsPrincipal = new ClaimsPrincipal(); var user = new WebApiUser(claimsPrincipal); user.Invoking(x => x.SetTokenIssueDate(claims)).ShouldNotThrow(); }
public void TestSetUserId_InvalidGuid_ShouldNotThrow() { var id = "hello"; var claims = new List <Claim>(); claims.Add(new Claim(WebApiUser.USER_ID_KEY, id.ToString())); var claimsPrincipal = new ClaimsPrincipal(); var user = new WebApiUser(claimsPrincipal); Assert.AreEqual(Guid.Empty, user.Id); user.Invoking(x => x.SetUserId(claims)).ShouldNotThrow(); }