public void AnnounceServer_Throws() { // GIVEN const string serverId = "server-001"; var serverContext = new Server.ServerContext { Queues = new[] { "queue 1", "queue 2" }, WorkerCount = 32 }; // WHEN THEN Assert.Throws <HangfireElasticSearchException>(() => _elasticConnection.AnnounceServer(serverId, serverContext)); }
public void AnnounceServer_WhenServerNotExists_SavesServer() { // GIVEN const string serverId = "server-001"; var serverContext = new Server.ServerContext { Queues = new[] { "queue 1", "queue 2" }, WorkerCount = 32 }; // WHEN _elasticConnection.AnnounceServer(serverId, serverContext); // THEN var serverResponse = _elasticClient.Get <Model.Server>(serverId).ThrowIfInvalid(); serverResponse.Found.Should().BeTrue(); var server = serverResponse.Source; server.Queues.ShouldBeEquivalentTo(serverContext.Queues); server.WorkerCount.Should().Be(serverContext.WorkerCount); }