Fixing a bug that was causing property updates to not be sent. (#311)

This commit is contained in:
Peter Felts 2018-11-07 12:07:41 -08:00 коммит произвёл Harleen Thind
Родитель 01cfbcfc4f
Коммит 0e33f70d64
2 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -25,7 +25,7 @@ namespace SimulationAgent.Test.DeviceProperties
private readonly Mock<ILogger> logger;
private readonly Mock<IActorsLogger> actorsLogger;
private readonly Mock<CredentialsSetup> credentialSetup;
private readonly Mock<IRateLimiting> rateLimiting;
private readonly Mock<IRateLimiting> mockRateLimiting;
private readonly Mock<IRateLimitingConfig> rateLimitingConfig;
private readonly Mock<IDevices> devices;
private readonly Mock<IStorageAdapterClient> storageAdapterClient;
@ -46,7 +46,7 @@ namespace SimulationAgent.Test.DeviceProperties
{
this.logger = new Mock<ILogger>();
this.actorsLogger = new Mock<IActorsLogger>();
this.rateLimiting = new Mock<IRateLimiting>();
this.mockRateLimiting = new Mock<IRateLimiting>();
this.credentialSetup = new Mock<CredentialsSetup>();
this.rateLimitingConfig = new Mock<IRateLimitingConfig>();
this.mockDeviceContext = new Mock<IDeviceConnectionActor>();
@ -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<ISimulationContext>();
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,

Просмотреть файл

@ -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;