diff --git a/SimulationAgent.Test/DeviceProperties/DevicePropertiesActorTest.cs b/SimulationAgent.Test/DeviceProperties/DevicePropertiesActorTest.cs index a26d2a10..fddcfcf6 100644 --- a/SimulationAgent.Test/DeviceProperties/DevicePropertiesActorTest.cs +++ b/SimulationAgent.Test/DeviceProperties/DevicePropertiesActorTest.cs @@ -25,7 +25,7 @@ namespace SimulationAgent.Test.DeviceProperties private readonly Mock logger; private readonly Mock actorsLogger; private readonly Mock credentialSetup; - private readonly Mock rateLimiting; + private readonly Mock mockRateLimiting; private readonly Mock rateLimitingConfig; private readonly Mock devices; private readonly Mock storageAdapterClient; @@ -46,7 +46,7 @@ namespace SimulationAgent.Test.DeviceProperties { this.logger = new Mock(); this.actorsLogger = new Mock(); - this.rateLimiting = new Mock(); + this.mockRateLimiting = new Mock(); this.credentialSetup = new Mock(); this.rateLimitingConfig = new Mock(); this.mockDeviceContext = new Mock(); @@ -151,7 +151,7 @@ namespace SimulationAgent.Test.DeviceProperties this.target = new DevicePropertiesActor( this.logger.Object, this.actorsLogger.Object, - this.rateLimiting.Object, + this.mockRateLimiting.Object, this.updatePropertiesLogic.Object, this.deviceTagLogic.Object, this.mockInstance.Object); @@ -164,6 +164,7 @@ namespace SimulationAgent.Test.DeviceProperties var mockSimulationContext = new Mock(); mockSimulationContext.Object.InitAsync(testSimulation).Wait(Constants.TEST_TIMEOUT); mockSimulationContext.SetupGet(x => x.Devices).Returns(this.devices.Object); + mockSimulationContext.SetupGet(x => x.RateLimiting).Returns(this.mockRateLimiting.Object); this.target.Init( mockSimulationContext.Object, diff --git a/SimulationAgent/DeviceProperties/DevicePropertiesActor.cs b/SimulationAgent/DeviceProperties/DevicePropertiesActor.cs index cc5d2abe..9b276360 100644 --- a/SimulationAgent/DeviceProperties/DevicePropertiesActor.cs +++ b/SimulationAgent/DeviceProperties/DevicePropertiesActor.cs @@ -270,7 +270,7 @@ namespace Microsoft.Azure.IoTSolutions.DeviceSimulation.SimulationAgent.DevicePr { // considering the throttling settings, when can the properties be updated var now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); - var pauseMsec = this.rateLimiting.GetPauseForNextTwinWrite(); + var pauseMsec = this.simulationContext.RateLimiting.GetPauseForNextTwinWrite(); this.whenToRun = now + pauseMsec; this.status = ActorStatus.ReadyToUpdate; @@ -289,7 +289,7 @@ namespace Microsoft.Azure.IoTSolutions.DeviceSimulation.SimulationAgent.DevicePr { var now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); // note: we overwrite the twin, so no Read operation is needed - var pauseMsec = this.rateLimiting.GetPauseForNextTwinWrite(); + var pauseMsec = this.simulationContext.RateLimiting.GetPauseForNextTwinWrite(); this.whenToRun = now + pauseMsec; this.status = ActorStatus.ReadyToTagDevice;