Beispiel #1
0
        public async Task <Auditor> TraceElasticsearchException(ClientCall callTrace, Action <ElasticsearchClientException> assert)
        {
            this._cluster = _cluster ?? this.Cluster();
            this._cluster.ClientThrows(true);
            this.AssertPoolBeforeCall?.Invoke(this._cluster.ConnectionPool);

            Action call      = () => this._cluster.ClientCall(callTrace?.RequestOverrides);
            var    exception = call.ShouldThrowExactly <ElasticsearchClientException>()
                               .Subject.First();

            assert(exception);

            this.AuditTrail = exception.AuditTrail;
            this.AssertPoolAfterCall?.Invoke(this._cluster.ConnectionPool);

            this._clusterAsync = _clusterAsync ?? this.Cluster();
            this._clusterAsync.ClientThrows(true);
            Func <Task> callAsync = async() => await this._clusterAsync.ClientCallAsync(callTrace?.RequestOverrides);

            exception = callAsync.ShouldThrowExactly <ElasticsearchClientException>()
                        .Subject.First();
            assert(exception);

            this.AsyncAuditTrail = exception.AuditTrail;
            this.AssertPoolAfterCall?.Invoke(this._clusterAsync.ConnectionPool);
            var audit = new Auditor(_cluster, _clusterAsync);

            return(await audit.TraceElasticsearchExceptionOnResponse(callTrace, assert));
        }
Beispiel #2
0
        public async Task <Auditor> TraceElasticsearchException(ClientCall callTrace, Action <ElasticsearchClientException> assert)
        {
            await this.TraceException(callTrace, assert);

            var audit = new Auditor(_cluster, _clusterAsync);

            return(await audit.TraceElasticsearchExceptionOnResponse(callTrace, assert));
        }
Beispiel #3
0
		public async Task<Auditor> TraceElasticsearchException(ClientCall callTrace, Action<ElasticsearchClientException> assert)
		{
			this._cluster  = _cluster ?? this.Cluster();
			this._cluster.ClientThrows(true);
			this.AssertPoolBeforeCall?.Invoke(this._cluster.ConnectionPool);

			Action call = () => this._cluster.ClientCall(callTrace?.RequestOverrides);
			var exception = call.ShouldThrowExactly<ElasticsearchClientException>()
				.Subject.First();
			assert(exception);

			this.AuditTrail = exception.AuditTrail;
			this.AssertPoolAfterCall?.Invoke(this._cluster.ConnectionPool);

			this._clusterAsync = _clusterAsync ?? this.Cluster();
			this._clusterAsync.ClientThrows(true);
			Func<Task> callAsync = async () => await this._clusterAsync.ClientCallAsync(callTrace?.RequestOverrides);
			exception = callAsync.ShouldThrowExactly<ElasticsearchClientException>()
				.Subject.First();
			assert(exception);

			this.AsyncAuditTrail = exception.AuditTrail;
			this.AssertPoolAfterCall?.Invoke(this._clusterAsync.ConnectionPool);
			var audit  = new Auditor(_cluster, _clusterAsync);
			return await audit.TraceElasticsearchExceptionOnResponse(callTrace, assert);
		}