public static BoxClient GetClient(OAuthSession session) { var handler = new BoxHttpRequestHandler(); var converter = new BoxJsonConverter(); var service = new BoxService(handler); var authRepository = new AuthRepository(Config, service, converter, session); var client = new BoxClient(Config, converter, handler, service, authRepository); return client; }
public BoxResourceManagerTest() { // Initial Setup _converter = new BoxJsonConverter(); _handler = new Mock<IRequestHandler>(); _service = new BoxService(_handler.Object); _config = new Mock<IBoxConfig>(); _authRepository = new AuthRepository(_config.Object, _service, _converter, new OAuthSession("fakeAccessToken", "fakeRefreshToken", 3600, "bearer")); }
public async Task AuthenticateLive_InvalidAuthCode_Exception() { // Arrange IRequestHandler handler = new HttpRequestHandler(); IBoxService service = new BoxService(handler); IBoxConfig config = new BoxConfig(null, null, null); IAuthRepository authRepository = new AuthRepository(config, service, _converter); // Act OAuthSession response = await authRepository.AuthenticateAsync("fakeAuthorizationCode"); }
/// <summary> /// Instantiates a BoxClient with the provided config object and auth session /// </summary> /// <param name="boxConfig">The config object to be used</param> /// <param name="authSession">A fully authenticated auth session</param> public BoxClient(IBoxConfig boxConfig, OAuthSession authSession) { _config = boxConfig; IRequestHandler handler = new HttpRequestHandler(); _converter = new BoxJsonConverter(); _service = new BoxService(handler); Auth = new AuthRepository(_config, _service, _converter, authSession); InitManagers(); }