public void Dispose_should_mark_endpoint_disposed() { var endpoint = new Endpoint(Guid.Empty, MonitorMock.Mock("monitor"), "address", "name", "group"); Assert.False(endpoint.IsDisposed); endpoint.Dispose(); Assert.True(endpoint.IsDisposed); }
public void Dispose_should_remove_health_information_and_update_last_modified_time_as_well_as_IsDisposed_property() { var endpoint = new Endpoint(_timeCoordinator.Object, new EndpointIdentity(Guid.NewGuid(), "monitor", "address"), new EndpointMetadata("name", "group", null, EndpointMetadata.DefaultMonitorTag, DateTime.UtcNow, DateTime.UtcNow)); endpoint.UpdateHealth(new EndpointHealth(DateTime.UtcNow, TimeSpan.Zero, EndpointStatus.Healthy)); DateTime expectedLastModifiedTime = DateTime.UtcNow; _timeCoordinator.Setup(c => c.UtcNow).Returns(expectedLastModifiedTime); endpoint.Dispose(); Assert.True(endpoint.IsDisposed); Assert.Null(endpoint.Health); Assert.Equal(expectedLastModifiedTime, endpoint.LastModifiedTimeUtc); }