protected override void Arrange() { _clientAppRepo = MockRepository.GenerateStub <IClientAppRepo>(); _tokenRequest = new TokenRequest { Client_id = ClientId, Client_secret = ClientSecret }; _apiClientAuthenticator = MockRepository.GenerateStub <IApiClientAuthenticator>(); ApiClientIdentity apiClientIdentity; _apiClientAuthenticator .Expect(aca => aca.TryAuthenticate(null, null, out apiClientIdentity)) .IgnoreArguments() .Do( new ApiClientAuthenticatorDelegates.TryAuthenticateDelegate( (string key, string password, out ApiClientIdentity identity) => { identity = null; return(false); })); _clientCredentialsTokenRequestHandler = new ClientCredentialsTokenRequestHandler(_clientAppRepo, _apiClientAuthenticator); }
protected override void Arrange() { var apiClient = new ApiClient { ApiClientId = 0 }; _clientAppRepo = mocks.Stub <IClientAppRepo>(); _clientAppRepo.Expect(c => c.GetClient(Arg <string> .Is.Anything)) .Return(apiClient); _clientAppRepo.Expect(c => c.AddClientAccessToken(0)) .Return(new ClientAccessToken()); _tokenRequest = new TokenRequest { Client_id = ClientId, Client_secret = ClientSecret }; _apiClientAuthenticator = _apiClientAuthenticatorHelper.Mock(mocks); _clientCredentialsTokenRequestHandler = new ClientCredentialsTokenRequestHandler(_clientAppRepo, _apiClientAuthenticator); }