Пример #1
0
 public void WaitFor(int seconds)
 {
     for (int i = 0; i < seconds; i++)
     {
         TimerAction.Execute();
     }
 }
Пример #2
0
        public async Task Execute_Should_UpdateStorageStatus_If_StatusChanged()
        {
            //Arrange
            var siteId   = Guid.NewGuid();
            var siteUri  = new Uri($"http://{siteId}");
            var siteInfo = new SiteInfoEntity(siteId, siteUri, RefreshPeriod.FromSeconds(3));

            siteInfo.SetStatus(SiteStatus.Offline);

            _siteStorageMock.Setup(x => x.GetSiteInfo(siteId)).ReturnsAsync(siteInfo);
            _siteStatusCheckerMock.Setup(x => x.GetStatus(siteUri)).ReturnsAsync(StatusCheckResult.Success);

            //Act
            await _target.Execute(siteId, siteUri);

            //Assert
            _siteStorageMock.Verify(x => x.UpdateStatus(siteId, SiteStatus.Online), Times.Once);
        }