public async Task Initialize() { _driver = WebDriverUtils.InitializeChromeDriver(); _client = new DocmsApiClient("docms-client", Constants.TestUrlBase); await DocumentUtils.ClearAllAsync(_client.CreateDocumentClient()).ConfigureAwait(false); WebDriverUtils.LoginAsAdmin(_driver); }
public async Task ThrowsConnectionExceptionWhenServerIsNotUp() { using (var server = new MockHttpServer(8000, context => { })) { } using (var client = new DocmsApiClient("docms-client-1", "http://localhost:8000")) { var docClient = client.CreateDocumentClient(); await Assert.ThrowsExceptionAsync <ConnectionException>(() => docClient.GetEntriesAsync()); } }
public async Task ThrowsUnauthorizedExceptionWhenClientIsNotAuthenticated() { using (var server = new MockHttpServer(8000, context => { context.Response.StatusCode = 401; context.Response.Close(); })) using (var client = new DocmsApiClient("docms-client-1", "http://localhost:8000")) { var docClient = client.CreateDocumentClient(); await Assert.ThrowsExceptionAsync <UnauthorizedException>(() => docClient.GetEntriesAsync()); } }
public DocumentClient(DocmsApiClient client) { _client = client; }