public void Should_Decode_Payload() { // Given ZumoJwtUtility sut = new ZumoJwtUtility(); // When var result = sut.DecodePayload(Payload); // Then result.Should().Be("{\"sub\":\"jdoe\",\"name\":\"John Doe\",\"iat\":1516239022,\"Organization\":\"123456\",\"Facilities\":[\"1\",\"2\",\"3\",\"4\"],\"Role\":\"Admin\",\"aud\":\"Administrators\",\"exp\":15000,\"iss\":\"https://issuer.com\",\"ver\":\"1.2.1.900\"}"); }
public void Should_Throw_If_Payload_Not_Formatted() { // Given ZumoJwtUtility sut = new ZumoJwtUtility(); // When var result = Record.Exception(() => sut.DecodePayload(JwtString)); // Then result.Should().NotBeNull(); result.Should().BeOfType <FormatException>(); }
public void Should_Throw_If_Payload_Not_Valid() { // Given ZumoJwtUtility sut = new ZumoJwtUtility(); // When var result = Record.Exception(() => sut.DecodePayload("00001")); // Then result.Should().NotBeNull(); result.Should().BeOfType <InvalidTokenException>(); }