refreshTokenRepository) Arrange() { var jwtService = Substitute.For <IJwtService>(); var userRepository = Substitute.For <IUserRepository>(); var refreshTokenRepository = Substitute.For <IRefreshTokenRepository>(); var fakeJwt = new JsonWebToken { Id = Guid.NewGuid().ToString(), Claims = new Dictionary <string, string> { { "first_claim", "first_claim_value" }, { "second_claim", "second_claim_value" } }, Expires = DateTime.UtcNow.AddMinutes(1), Role = Role.User, AccessToken = Guid.NewGuid().ToString(), RefreshToken = Guid.NewGuid().ToString() }; jwtService.CreateToken(Arg.Any <string>()).ReturnsForAnyArgs(fakeJwt); var passwordHasher = new PasswordHasher <User>(); var fakeUser = FakeCredentialsProvider.GetUser(passwordHasher); var sut = new GetUsersProfilesHandler(userRepository); return(fakeUser, sut, userRepository, refreshTokenRepository); }
private static (User fakeUser, ChangePasswordHandler sut, IUserRepository userRepository) Arrange() { var userRepository = Substitute.For <IUserRepository>(); var passwordHasher = new PasswordHasher <User>(); var fakeUser = FakeCredentialsProvider.GetUser(passwordHasher); var sut = new ChangePasswordHandler( userRepository, passwordHasher ); return(fakeUser, sut, userRepository); }