ASP .NET 7 - Testing a JWT Token Generator
I have an ASP .NET web api which calls a CreateToken() method inside a TokenService to generate a JWT when a user logs in. The public implementation looks like this:
There's also 3 private helper methods inside TokenService which are used to help generate the token. I should only be testing the public method correct? Also, what should I be testing for here? I've done basic unit tests before (like testing an AddNumbers(int 1, int 2)), but am I supposed to generate the token in the test and then compare it to a "correctly" generated version?
0 Replies