Exemplo n.º 1
0
        private void GivenTheProviderWillReturnsSomeStates()
        {
            for (var i = 0; i < 3; i++)
            {
                _expectedEnvironmentStates.Add(new EnvironmentState(_fixture.Create <int>(), _fixture.CreateMany <ToggleState>()));
            }

            _provider.Invoke(Arg.Any <Guid>(), Arg.Any <string>())
            .Returns(_expectedEnvironmentStates[0], _expectedEnvironmentStates[1], _expectedEnvironmentStates[2]);
        }
Exemplo n.º 2
0
 private void SynchronizeEnvironmentStates()
 {
     try
     {
         _logger.LogTrace("Synchronizing {@projectId} {@environmentKey}", _environmentOptions.ProjectId, _environmentOptions.Environment);
         var environmentState = _provider.Invoke(_environmentOptions.ProjectId, _environmentOptions.Environment);
         _repo.Set(environmentState);
         _logger.LogTrace("Synchronized {@projectId} {@environmentKey}", _environmentOptions.ProjectId, _environmentOptions.Environment);
     }
     catch (Exception ex)
     {
         _logger.LogWarning(ex, "Failed to synchronize {@projectId} {@environmentKey}. Toggle states might be stale.", _environmentOptions.ProjectId, _environmentOptions.Environment);
     }
 }