示例#1
0
        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);
        }
示例#2
0
        public void AdvanceMinutes()
        {
            FakeClock clock = new FakeClock(Instant.FromUnixTimeTicks(100L));

            clock.AdvanceMinutes(3);
            Assert.AreEqual(100 + 3 * NodaConstants.TicksPerMinute, clock.GetCurrentInstant().ToUnixTimeTicks());
        }
示例#3
0
        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();
        }