public void Throws_Encode_With_Empty_Key() { JoseJwtProvider jwtProvider = new JoseJwtProvider(); Assert.Throws(typeof(ArgumentNullException), () => jwtProvider.Encode(new Dictionary <string, string>() { { "key", "val" } }, null)); }
public void Encode_Payload() { JoseJwtProvider jwtProvider = new JoseJwtProvider(); string token; using (var rsa = new RSACryptoServiceProvider()) { rsa.ImportParameters(Helpers.Common.MockRSAParams); token = jwtProvider.Encode(new Dictionary <string, string>() { { "key", "val" } }, rsa); } Assert.NotEmpty(token); }
public void Throws_Encode_With_Empty_Payload() { JoseJwtProvider jwtProvider = new JoseJwtProvider(); Assert.Throws(typeof(ArgumentNullException), () => { using (var rsa = new RSACryptoServiceProvider()) { rsa.ImportParameters(Helpers.Common.MockRSAParams); jwtProvider.Encode(new Dictionary <string, string>(), rsa); } } ); Assert.Throws(typeof(ArgumentNullException), () => { using (var rsa = new RSACryptoServiceProvider()) { rsa.ImportParameters(Helpers.Common.MockRSAParams); jwtProvider.Encode(null, rsa); } }); }