public async Task ScanAndToggleMqttEntityConnectedStatus_DoesNotChangeConnectedStatusIfNotConnected() { var sensors = await SeedEntitiesAsync(1); _clock.AdvanceMinutes(TimeOverWindow); _job.ScanAndToggleMqttEntityConnectedStatus(); Assert.False(sensors[0].Connected); Assert.False(sensors[0].Device.Connected); }
public void AdvanceMinutes() { FakeClock clock = new FakeClock(Instant.FromUnixTimeTicks(100L)); clock.AdvanceMinutes(3); Assert.AreEqual(100 + 3 * NodaConstants.TicksPerMinute, clock.GetCurrentInstant().ToUnixTimeTicks()); }
public void AdvanceMinutes() { FakeClock clock = new FakeClock(new Instant(100L)); clock.AdvanceMinutes(3); Assert.AreEqual(100 + 3 * NodaConstants.TicksPerMinute, clock.Now.Ticks); }
public async Task UpdateExistingSharedState_SetsUpdatedTime() { Instant createdInstant = SystemClock.Instance.GetCurrentInstant(); //Arrange FakeClock fakeClock = new FakeClock(createdInstant); SharedStateController controller = new SharedStateController(new TestDatabaseHandler <SharedState.SharedState>(), fakeClock); string anchorSetId = "anchorSetId"; string spaceid = "spaceId"; SharedStateDto sharedState = new SharedStateDto(new SharedState.SharedState() { Id = anchorSetId, CurrentSelectedSpace = spaceid }); //Act await controller.UpdateSharedState(anchorSetId, sharedState); fakeClock.AdvanceMinutes(1); await controller.UpdateSharedState(anchorSetId, sharedState); //Assert SharedState.SharedState fetchedState = await controller.GetSharedState(anchorSetId); fetchedState.CreatedAt.Should().Be(createdInstant); fetchedState.UpdatedAt.Should().Be(createdInstant.Plus(Duration.FromMinutes(1))); }
public void GettingEntry_AfterExpirationTime_ShouldReturnLeft() { var entry = new Entry(_dataProtector.Protect(Password), null, Duration.FromMinutes(1), _clock); _dbContext.Entries.Add(entry); _clock.AdvanceMinutes(3); var result = _sut.Get(entry.Id); result.IsLeft.Should().BeTrue(); }