Esempio n. 1
0
        internal WardenManager(IWarden warden, WardenManagerConfiguration configuration)
        {
            if (warden == null)
            {
                throw new ArgumentException("Warden instance can not be null.", nameof(warden));
            }
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration),
                                                "Warden Manager configuration has not been provided.");
            }

            _warden        = warden;
            _configuration = configuration;
            _commandSource = _configuration.WardenCommandSourceProvider();
            _eventHandler  = _configuration.WardenEventHandlerProvider();
            _logger        = _configuration.WardenLoggerProvider();
            _commandSource.CommandReceivedAsync += async(command) => await HandleCommandAsync(command);
        }
Esempio n. 2
0
 /// <summary>
 /// Factory method for creating a new Warden Manager instance with provided configuration.".
 /// </summary>
 /// <param name="warden">Instance of the IWarden.</param>
 /// <param name="configuration">Configuration of WardenManager.</param>
 /// <returns>Instance of IWardenManager.</returns>
 public static IWardenManager Create(IWarden warden, WardenManagerConfiguration configuration)
 => new WardenManager(warden, configuration);