public void DefaultValues() { // Arrange var config = new DefaultConfigurationManager(); // Assert Assert.Equal(110, config.ConnectionTimeout.TotalSeconds); Assert.Equal(30, config.DisconnectTimeout.TotalSeconds); Assert.Equal(10, config.KeepAlive.Value.TotalSeconds); Assert.Equal(20, config.KeepAliveTimeout().Value.TotalSeconds); Assert.Equal(5, config.HeartbeatInterval().TotalSeconds); Assert.Equal(100, config.TopicTtl().TotalSeconds); }
public void TopicTimeToLiveIsDoubleTheDisconnectAndKeepAliveTimeouts() { var config = new DefaultConfigurationManager(); var random = new Random(); config.DisconnectTimeout = TimeSpan.FromSeconds(random.Next(12, 31536000)); // 12 seconds to a year config.KeepAlive = TimeSpan.FromTicks(config.DisconnectTimeout.Ticks / 6); // Set custom keep-alive to half the default // Assert Assert.Equal(TimeSpan.FromTicks(config.DisconnectTimeout.Ticks * 2 + config.KeepAliveTimeout().Value.Ticks * 2), config.TopicTtl()); }
public void KeepAliveTimeoutIsTwiceTheKeepAlive() { // Arrange var config = new DefaultConfigurationManager(); var random = new Random(); config.KeepAlive = TimeSpan.FromSeconds(random.NextDouble() * 8 + 2); // 2 to 10 seconds // Assert Assert.Equal(TimeSpan.FromTicks(config.KeepAlive.Value.Ticks * 2), config.KeepAliveTimeout()); // Arrange config.KeepAlive = null; // Assert Assert.Equal(null, config.KeepAliveTimeout()); }