public void Heartbeat_Throws() { // GIVEN const string serverId = "server-001"; // WHEN THEN Assert.Throws <HangfireElasticSearchException>(() => _elasticConnection.Heartbeat(serverId)); }
public void Heartbeat_WithExistingServer_UpdatesHeartbeat() { // GIVEN const string serverId = "server-001"; var server = new Model.Server { Id = serverId, LastHeartBeat = new DateTime(2017, 10, 1) }; _elasticClient.Index(server, descr => descr.Refresh(Refresh.True)).ThrowIfInvalid(); // WHEN _elasticConnection.Heartbeat(serverId); // THEN var getServerResponse = _elasticClient.Get <Model.Server>(serverId).ThrowIfInvalid(); getServerResponse.Found.Should().BeTrue(); getServerResponse.Source.LastHeartBeat.Should().NotBe(server.LastHeartBeat); }