Skip to content

Commit

Permalink
Fix missing using clause on Disposable Instances for unit tests (#851)
Browse files Browse the repository at this point in the history
  • Loading branch information
kbeaugrand authored Jun 23, 2022
1 parent aea8ec7 commit f7f7328
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void ConcentratorMetricExporterServiceShouldExportConcentratorCountAndCon
this.portalMetric.ConcentratorCount = 15;
this.portalMetric.ConnectedConcentratorCount = 8;

var cancellationToken = new CancellationTokenSource();
using var cancellationToken = new CancellationTokenSource();

// Act
_ = this.concentratorMetricExporterService.StartAsync(cancellationToken.Token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void ConcentratorMetricLoaderServiceShouldLoadConcentratorCountAndConnect
_ = this.mockDeviceService.Setup(service => service.GetConcentratorsCount()).ReturnsAsync(10);
_ = this.mockDeviceService.Setup(service => service.GetConnectedConcentratorsCount()).ReturnsAsync(3);

var cancellationToken = new CancellationTokenSource();
using var cancellationToken = new CancellationTokenSource();

// Act
_ = this.concentratorMetricLoaderService.StartAsync(cancellationToken.Token);
Expand All @@ -76,7 +76,7 @@ public void ConcentratorMetricLoaderServiceShouldHandleInternalServerErrorExcept
_ = this.mockDeviceService.Setup(service => service.GetConcentratorsCount()).ThrowsAsync(new InternalServerErrorException("test"));
_ = this.mockDeviceService.Setup(service => service.GetConnectedConcentratorsCount()).ReturnsAsync(3);

var cancellationToken = new CancellationTokenSource();
using var cancellationToken = new CancellationTokenSource();

// Act
_ = this.concentratorMetricLoaderService.StartAsync(cancellationToken.Token);
Expand All @@ -99,7 +99,7 @@ public void ConcentratorMetricLoaderServiceShouldHandleInternalServerErrorExcept
_ = this.mockDeviceService.Setup(service => service.GetConcentratorsCount()).ReturnsAsync(10);
_ = this.mockDeviceService.Setup(service => service.GetConnectedConcentratorsCount()).ThrowsAsync(new InternalServerErrorException("test"));

var cancellationToken = new CancellationTokenSource();
using var cancellationToken = new CancellationTokenSource();

// Act
_ = this.concentratorMetricLoaderService.StartAsync(cancellationToken.Token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void DeviceMetricExporterServiceShouldExportDeviceCountAndConnectedConnec
this.portalMetric.DeviceCount = 15;
this.portalMetric.ConnectedDeviceCount = 8;

var cancellationToken = new CancellationTokenSource();
using var cancellationToken = new CancellationTokenSource();

// Act
_ = this.deviceMetricExporterService.StartAsync(cancellationToken.Token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void DeviceMetricLoaderServiceShouldLoadDeviceCountAndConnectedDeviceCoun
_ = this.mockDeviceService.Setup(service => service.GetDevicesCount()).ReturnsAsync(10);
_ = this.mockDeviceService.Setup(service => service.GetConnectedDevicesCount()).ReturnsAsync(3);

var cancellationToken = new CancellationTokenSource();
using var cancellationToken = new CancellationTokenSource();

// Act
_ = this.deviceMetricLoaderService.StartAsync(cancellationToken.Token);
Expand All @@ -76,7 +76,7 @@ public void DeviceMetricLoaderServiceShouldHandleInternalServerErrorExceptionWhe
_ = this.mockDeviceService.Setup(service => service.GetDevicesCount()).ThrowsAsync(new InternalServerErrorException("test"));
_ = this.mockDeviceService.Setup(service => service.GetConnectedDevicesCount()).ReturnsAsync(3);

var cancellationToken = new CancellationTokenSource();
using var cancellationToken = new CancellationTokenSource();

// Act
_ = this.deviceMetricLoaderService.StartAsync(cancellationToken.Token);
Expand All @@ -99,7 +99,7 @@ public void DeviceMetricLoaderServiceShouldHandleInternalServerErrorExceptionWhe
_ = this.mockDeviceService.Setup(service => service.GetDevicesCount()).ReturnsAsync(10);
_ = this.mockDeviceService.Setup(service => service.GetConnectedDevicesCount()).ThrowsAsync(new InternalServerErrorException("test"));

var cancellationToken = new CancellationTokenSource();
using var cancellationToken = new CancellationTokenSource();

// Act
_ = this.deviceMetricLoaderService.StartAsync(cancellationToken.Token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void DeviceMetricExporterServiceShouldExportDeviceCountAndConnectedConnec
this.portalMetric.ConnectedEdgeDeviceCount = 8;
this.portalMetric.FailedDeploymentCount = 3;

var cancellationToken = new CancellationTokenSource();
using var cancellationToken = new CancellationTokenSource();

// Act
_ = this.edgeDeviceMetricExporterService.StartAsync(cancellationToken.Token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void EdgeDeviceMetricLoaderServiceShouldLoadEdgeDeviceCountAndConnectedEd
_ = this.mockDeviceService.Setup(service => service.GetConnectedEdgeDevicesCount()).ReturnsAsync(3);
_ = this.mockConfigService.Setup(service => service.GetFailedDeploymentsCount()).ReturnsAsync(1);

var cancellationToken = new CancellationTokenSource();
using var cancellationToken = new CancellationTokenSource();

// Act
_ = this.edgeDeviceMetricLoaderService.StartAsync(cancellationToken.Token);
Expand All @@ -82,7 +82,7 @@ public void EdgeDeviceMetricLoaderServiceShouldHandleInternalServerErrorExceptio
_ = this.mockDeviceService.Setup(service => service.GetConnectedEdgeDevicesCount()).ReturnsAsync(3);
_ = this.mockConfigService.Setup(service => service.GetFailedDeploymentsCount()).ReturnsAsync(1);

var cancellationToken = new CancellationTokenSource();
using var cancellationToken = new CancellationTokenSource();

// Act
_ = this.edgeDeviceMetricLoaderService.StartAsync(cancellationToken.Token);
Expand All @@ -107,7 +107,7 @@ public void EdgeDeviceMetricLoaderServiceShouldHandleInternalServerErrorExceptio
_ = this.mockDeviceService.Setup(service => service.GetConnectedEdgeDevicesCount()).ThrowsAsync(new InternalServerErrorException("test"));
_ = this.mockConfigService.Setup(service => service.GetFailedDeploymentsCount()).ReturnsAsync(1);

var cancellationToken = new CancellationTokenSource();
using var cancellationToken = new CancellationTokenSource();

// Act
_ = this.edgeDeviceMetricLoaderService.StartAsync(cancellationToken.Token);
Expand All @@ -131,7 +131,7 @@ public void EdgeDeviceMetricLoaderServiceShouldHandleInternalServerErrorExceptio
_ = this.mockDeviceService.Setup(service => service.GetConnectedEdgeDevicesCount()).ReturnsAsync(3);
_ = this.mockConfigService.Setup(service => service.GetFailedDeploymentsCount()).ThrowsAsync(new InternalServerErrorException("test"));

var cancellationToken = new CancellationTokenSource();
using var cancellationToken = new CancellationTokenSource();

// Act
_ = this.edgeDeviceMetricLoaderService.StartAsync(cancellationToken.Token);
Expand Down

0 comments on commit f7f7328

Please sign in to comment.