public async Task <Auditor> TraceStartup(ClientCall callTrace = null) { this._cluster = _cluster ?? this.Cluster(); if (!this.StartedUp) { this.AssertPoolBeforeStartup?.Invoke(this._cluster.ConnectionPool); } this.AssertPoolBeforeCall?.Invoke(this._cluster.ConnectionPool); this.Response = this._cluster.ClientCall(callTrace?.RequestOverrides); this.AuditTrail = this.Response.ApiCall.AuditTrail; if (!this.StartedUp) { this.AssertPoolAfterStartup?.Invoke(this._cluster.ConnectionPool); } this.AssertPoolAfterCall?.Invoke(this._cluster.ConnectionPool); this._clusterAsync = _clusterAsync ?? this.Cluster(); if (!this.StartedUp) { this.AssertPoolBeforeStartup?.Invoke(this._clusterAsync.ConnectionPool); } this.AssertPoolBeforeCall?.Invoke(this._clusterAsync.ConnectionPool); this.ResponseAsync = await this._clusterAsync.ClientCallAsync(callTrace?.RequestOverrides); this.AsyncAuditTrail = this.ResponseAsync.ApiCall.AuditTrail; if (!this.StartedUp) { this.AssertPoolAfterStartup?.Invoke(this._clusterAsync.ConnectionPool); } this.AssertPoolAfterCall?.Invoke(this._clusterAsync.ConnectionPool); return(new Auditor(_cluster, _clusterAsync)); }
#pragma warning disable 1998 public async Task <Auditor> TraceUnexpectedException(ClientCall callTrace, Action <UnexpectedElasticsearchClientException> assert) #pragma warning restore 1998 { this._cluster = _cluster ?? this.Cluster(); this.AssertPoolBeforeCall?.Invoke(this._cluster.ConnectionPool); Action call = () => this._cluster.ClientCall(callTrace?.RequestOverrides); var exception = call.ShouldThrowExactly <UnexpectedElasticsearchClientException>() .Subject.First(); assert(exception); this.AuditTrail = exception.AuditTrail; this.AssertPoolAfterCall?.Invoke(this._cluster.ConnectionPool); this._clusterAsync = _clusterAsync ?? this.Cluster(); Func <Task> callAsync = async() => await this._clusterAsync.ClientCallAsync(callTrace?.RequestOverrides); exception = callAsync.ShouldThrowExactly <UnexpectedElasticsearchClientException>() .Subject.First(); assert(exception); this.AsyncAuditTrail = exception.AuditTrail; this.AssertPoolAfterCall?.Invoke(this._clusterAsync.ConnectionPool); return(new Auditor(_cluster, _clusterAsync)); }
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)); }
private async Task TraceException <TException>(ClientCall callTrace, Action <TException> assert) where TException : ElasticsearchClientException { 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 <TException>() .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 <TException>() .Subject.First(); assert(exception); this.AsyncAuditTrail = exception.AuditTrail; this.AssertPoolAfterCall?.Invoke(this._clusterAsync.ConnectionPool); }
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); }
public async Task <Auditor> TraceElasticsearchExceptionOnResponse(ClientCall callTrace, Action <ElasticsearchClientException> assert) { this._cluster = _cluster ?? this.Cluster(); this._cluster.ClientThrows(false); this.AssertPoolBeforeCall?.Invoke(this._cluster.ConnectionPool); Action call = () => { this.Response = this._cluster.ClientCall(callTrace?.RequestOverrides); }; call.ShouldNotThrow(); this.Response.IsValid.Should().BeFalse(); var exception = this.Response.ApiCall.OriginalException as ElasticsearchClientException; exception.Should().NotBeNull("OriginalException on response is not expected ElasticsearchClientException"); assert(exception); this.AuditTrail = exception.AuditTrail; this.AssertPoolAfterCall?.Invoke(this._cluster.ConnectionPool); this._clusterAsync = _clusterAsync ?? this.Cluster(); this._clusterAsync.ClientThrows(false); Func <Task> callAsync = async() => { this.ResponseAsync = await this._clusterAsync.ClientCallAsync(callTrace?.RequestOverrides); }; callAsync.ShouldNotThrow(); this.ResponseAsync.IsValid.Should().BeFalse(); exception = this.ResponseAsync.ApiCall.OriginalException as ElasticsearchClientException; exception.Should().NotBeNull("OriginalException on response is not expected ElasticsearchClientException"); assert(exception); this.AsyncAuditTrail = exception.AuditTrail; this.AssertPoolAfterCall?.Invoke(this._clusterAsync.ConnectionPool); var audit = new Auditor(_cluster, _clusterAsync); return(audit); }
public void ChangeTime(Func <DateTime, DateTime> selector) { this._cluster = _cluster ?? this.Cluster(); this._clusterAsync = _clusterAsync ?? this.Cluster(); this._cluster.ChangeTime(selector); this._clusterAsync.ChangeTime(selector); }
public void ChangeTime(Func<DateTime, DateTime> selector) { this._cluster = _cluster ?? this.Cluster(); this._clusterAsync = _clusterAsync ?? this.Cluster(); this._cluster.ChangeTime(selector); this._clusterAsync.ChangeTime(selector); }
public async Task <Auditor> TraceStartup() { this._cluster = _cluster ?? this.Cluster(); this.AssertPoolBeforeCall?.Invoke(this._cluster.ConnectionPool); this.Response = this._cluster.ClientCall(); this.AssertPoolAfterCall?.Invoke(this._cluster.ConnectionPool); this._clusterAsync = _clusterAsync ?? this.Cluster(); this.ResponseAsync = await this._clusterAsync.ClientCallAsync(); this.AssertPoolAfterCall?.Invoke(this._clusterAsync.ConnectionPool); return(new Auditor(_cluster, _clusterAsync)); }
public async Task<Auditor> TraceStartup(ClientCall callTrace = null) { this._cluster = _cluster ?? this.Cluster(); this.AssertPoolBeforeCall?.Invoke(this._cluster.ConnectionPool); this.Response = this._cluster.ClientCall(callTrace?.RequestOverrides); this.AuditTrail = this.Response.ApiCall.AuditTrail; this.AssertPoolAfterCall?.Invoke(this._cluster.ConnectionPool); this._clusterAsync = _clusterAsync ?? this.Cluster(); this.ResponseAsync = await this._clusterAsync.ClientCallAsync(callTrace?.RequestOverrides); this.AsyncAuditTrail = this.ResponseAsync.ApiCall.AuditTrail; this.AssertPoolAfterCall?.Invoke(this._clusterAsync.ConnectionPool); return new Auditor(_cluster, _clusterAsync); }
private Auditor(VirtualizedCluster cluster, VirtualizedCluster clusterAsync) { _cluster = cluster; _clusterAsync = clusterAsync; }
private Auditor(VirtualizedCluster cluster, VirtualizedCluster clusterAsync) { _cluster = cluster; _clusterAsync = clusterAsync; this.StartedUp = true; }
#pragma warning disable 1998 public async Task<Auditor> TraceElasticsearchExceptionOnResponse(ClientCall callTrace, Action<ElasticsearchClientException> assert) #pragma warning restore 1998 { this._cluster = _cluster ?? this.Cluster(); this._cluster.ClientThrows(false); this.AssertPoolBeforeCall?.Invoke(this._cluster.ConnectionPool); Action call = () => { this.Response = this._cluster.ClientCall(callTrace?.RequestOverrides); }; call.ShouldNotThrow(); this.Response.IsValid.Should().BeFalse(); var exception = this.Response.ApiCall.OriginalException as ElasticsearchClientException; exception.Should().NotBeNull("OriginalException on response is not expected ElasticsearchClientException"); assert(exception); this.AuditTrail = exception.AuditTrail; this.AssertPoolAfterCall?.Invoke(this._cluster.ConnectionPool); this._clusterAsync = _clusterAsync ?? this.Cluster(); this._clusterAsync.ClientThrows(false); Func<Task> callAsync = async () => { this.ResponseAsync = await this._clusterAsync.ClientCallAsync(callTrace?.RequestOverrides); }; callAsync.ShouldNotThrow(); this.ResponseAsync.IsValid.Should().BeFalse(); exception = this.ResponseAsync.ApiCall.OriginalException as ElasticsearchClientException; exception.Should().NotBeNull("OriginalException on response is not expected ElasticsearchClientException"); assert(exception); this.AsyncAuditTrail = exception.AuditTrail; this.AssertPoolAfterCall?.Invoke(this._clusterAsync.ConnectionPool); var audit = new Auditor(_cluster, _clusterAsync); return audit; }
#pragma warning disable 1998 public async Task<Auditor> TraceUnexpectedException(ClientCall callTrace, Action<UnexpectedElasticsearchClientException> assert) #pragma warning restore 1998 { this._cluster = _cluster ?? this.Cluster(); this.AssertPoolBeforeCall?.Invoke(this._cluster.ConnectionPool); Action call = () => this._cluster.ClientCall(callTrace?.RequestOverrides); var exception = call.ShouldThrowExactly<UnexpectedElasticsearchClientException>() .Subject.First(); assert(exception); this.AuditTrail = exception.AuditTrail; this.AssertPoolAfterCall?.Invoke(this._cluster.ConnectionPool); this._clusterAsync = _clusterAsync ?? this.Cluster(); Func<Task> callAsync = async () => await this._clusterAsync.ClientCallAsync(callTrace?.RequestOverrides); exception = callAsync.ShouldThrowExactly<UnexpectedElasticsearchClientException>() .Subject.First(); assert(exception); this.AsyncAuditTrail = exception.AuditTrail; this.AssertPoolAfterCall?.Invoke(this._clusterAsync.ConnectionPool); return new Auditor(_cluster, _clusterAsync); }