Ejemplo n.º 1
0
        public async Task Initialize()
        {
            _driver = WebDriverUtils.InitializeChromeDriver();
            _client = new DocmsApiClient("docms-client", Constants.TestUrlBase);
            await DocumentUtils.ClearAllAsync(_client.CreateDocumentClient()).ConfigureAwait(false);

            WebDriverUtils.LoginAsAdmin(_driver);
        }
Ejemplo n.º 2
0
 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());
     }
 }
Ejemplo n.º 3
0
 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());
         }
 }
Ejemplo n.º 4
0
 public DocumentClient(DocmsApiClient client)
 {
     _client = client;
 }