/// <summary> /// Initializes a new instance of the <see cref="BackgroundJobServer"/> class /// with the specified options and the given storage. /// </summary> /// <param name="options">Server options</param> /// <param name="storage">The storage</param> public BackgroundJobServer(BackgroundJobServerOptions options, JobStorage storage) { if (options == null) { throw new ArgumentNullException("options"); } if (storage == null) { throw new ArgumentNullException("storage"); } _options = options; _storage = storage; _serverId = String.Format("{0}:{1}", _options.ServerName.ToLowerInvariant(), Process.GetCurrentProcess().Id); // ReSharper disable once DoNotCallOverridableMethodsInConstructor _bootstrapSupervisor = GetBootstrapSupervisor(); Logger.Info("Starting Hangfire Server"); Logger.InfoFormat("Using job storage: '{0}'.", _storage); _storage.WriteOptionsToLog(Logger); _options.WriteToLog(Logger); _bootstrapSupervisor.Start(); }
public ServerGame([NotNull] IServer server, [NotNull] IServerSupervisor supervisor, [NotNull] IEnumerable <IServerUser> users, [NotNull] GameSettings settings, long gameIdentifier, [NotNull] ILogger logger) : base(users, settings) { if (server == null) { throw new ArgumentNullException(nameof(server)); } if (supervisor == null) { throw new ArgumentNullException(nameof(supervisor)); } if (users == null) { throw new ArgumentNullException(nameof(users)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } _server = server; _supervisor = supervisor; GameIdentifier = gameIdentifier; _logger = logger; InitTurnEndStates(); }
public void CopyTo_WorksAsExpected() { var collection = CreateCollection(); var array = new IServerSupervisor[3]; collection.CopyTo(array, 1); Assert.Same(_supervisor1.Object, array[1]); Assert.Same(_supervisor2.Object, array[2]); }
public BackgroundJobServer(BackgroundJobServerOptions options, JobStorage storage) { if (options == null) throw new ArgumentNullException("options"); if (storage == null) throw new ArgumentNullException("storage"); _options = options; _storage = storage; _serverId = String.Format("{0}:{1}", _options.ServerName.ToLowerInvariant(), Process.GetCurrentProcess().Id); // ReSharper disable once DoNotCallOverridableMethodsInConstructor _bootstrapSupervisor = GetBootstrapSupervisor(); }
public BackgroundJobServer(BackgroundJobServerOptions options, JobStorage storage) { if (options == null) { throw new ArgumentNullException("options"); } if (storage == null) { throw new ArgumentNullException("storage"); } _options = options; _storage = storage; _serverId = String.Format("{0}:{1}", _options.ServerName.ToLowerInvariant(), Process.GetCurrentProcess().Id); // ReSharper disable once DoNotCallOverridableMethodsInConstructor _bootstrapSupervisor = GetBootstrapSupervisor(); }
/// <summary> /// Initializes a new instance of the <see cref="BackgroundJobServer"/> class /// with the specified options and the given storage. /// </summary> /// <param name="options">Server options</param> /// <param name="storage">The storage</param> public BackgroundJobServer(BackgroundJobServerOptions options, JobStorage storage) { if (options == null) throw new ArgumentNullException("options"); if (storage == null) throw new ArgumentNullException("storage"); _options = options; _storage = storage; _serverId = String.Format("{0}:{1}", _options.ServerName.ToLowerInvariant(), Process.GetCurrentProcess().Id); // ReSharper disable once DoNotCallOverridableMethodsInConstructor _bootstrapSupervisor = GetBootstrapSupervisor(); Logger.Info("Starting Hangfire Server"); Logger.InfoFormat("Using job storage: '{0}'.", _storage); _storage.WriteOptionsToLog(Logger); _options.WriteToLog(Logger); _bootstrapSupervisor.Start(); }
public TestServer(IServerSupervisor hangfireJobServer, HangfireHostContextFilter hangfireHostContextFilter) { this.hangfireJobServer = hangfireJobServer; this.hangfireHostContextFilter = hangfireHostContextFilter; }
public static bool HasEverPlayedAgainst(this IServerUser me, IServerUser other, IServerSupervisor supervisor) { return(supervisor.GetWinStatistics(me.Login, other.Login).GetTotalGames() > 0); }
public void CopyTo_WorksAsExpected() { var collection = CreateCollection(); var array = new IServerSupervisor[3]; collection.CopyTo(array, 1); Assert.Same(_supervisor1.Object, array[1]); Assert.Same(_supervisor2.Object, array[2]); }