public void Should_Return_Role() { // Given ZumoJwtUtility sut = new ZumoJwtUtility(); // When var result = sut.GetToken <TestJwt>(JwtString); // Then result.Role.Should().Be("Admin"); }
public void Should_Return_Token_Of_Type() { // Given ZumoJwtUtility sut = new ZumoJwtUtility(); // When var result = sut.GetToken <TestJwt>(JwtString); // Then result.Should().BeOfType <TestJwt>(); }
public void Should_Return_Organization() { // Given ZumoJwtUtility sut = new ZumoJwtUtility(); // When var result = sut.GetToken <TestJwt>(JwtString); // Then result.Organization.Should().Be("123456"); }
public void Should_Return_Version() { // Given ZumoJwtUtility sut = new ZumoJwtUtility(); // When var result = sut.GetToken <TestJwt>(JwtString); // Then result.Version.Should().Be("1.2.1.900"); }
public void Should_Return_Subject() { // Given ZumoJwtUtility sut = new ZumoJwtUtility(); // When var result = sut.GetToken <TestJwt>(JwtString); // Then result.Subject.Should().Be("jdoe"); }
public void Should_Return_Issuer() { // Given ZumoJwtUtility sut = new ZumoJwtUtility(); // When var result = sut.GetToken <TestJwt>(JwtString); // Then result.Issuer.Should().Be("https://issuer.com"); }
public void Should_Throw_If_Jwt_Not_Valid(int take) { // Given var invalidToken = string.Join('.', JwtString.Split('.').Take(take)); ZumoJwtUtility sut = new ZumoJwtUtility(); // When var result = Record.Exception(() => sut.GetToken <TestJwt>(invalidToken)); // Then result.Should().BeOfType <InvalidTokenException>(); }
public void Should_Return_Facilities() { // Given ZumoJwtUtility sut = new ZumoJwtUtility(); // When var result = sut.GetToken <TestJwt>(JwtString); // Then result.Facilities.Should().Contain(x => x == "1"); result.Facilities.Should().Contain(x => x == "2"); result.Facilities.Should().Contain(x => x == "3"); result.Facilities.Should().Contain(x => x == "4"); }