public async Task InterceptAsync_DoesNot_CollectQueries_When_NotEnabled() { // arrange #if !NET45 var recorder = new AWSXRayRecorder { XRayOptions = new XRayOptions() }; #else var recorder = new AWSXRayRecorder(); #endif recorder.BeginSegment("test"); var interceptor = new DbCommandInterceptor(recorder); // act await interceptor.InterceptAsync(() => Task.FromResult(0), _command); // assert var segment = AWSXRayRecorder.Instance.TraceContext.GetEntity(); AssertNotCollected(recorder); recorder.EndSegment(); }
public async Task InterceptAsync_DoesNot_CollectQueries_When_EnabledGlobally_And_DisabledLocally() { // arrange #if !NET45 var recorder = new AWSXRayRecorder { XRayOptions = new XRayOptions { CollectSqlQueries = true } }; #else ConfigurationManager.AppSettings[_collectSqlQueriesKey] = "true"; AppSettings.Reset(); var recorder = new AWSXRayRecorder(); #endif var interceptor = new DbCommandInterceptor(recorder, collectSqlQueries: false); recorder.BeginSegment("test"); // act await interceptor.InterceptAsync(() => Task.FromResult(0), _command); // assert AssertNotCollected(recorder); recorder.EndSegment(); }