public void Close_is_idempotent_and_thread_safe() { var set = new ConcurrentExpiringSet <string>(); var ex = Record.Exception(() => { set.Close(); set.Close(); Parallel.Invoke(() => set.Close(), () => set.Close()); }); Assert.Null(ex); }
public void AddOrUpdate_throws_after_close() { var set = new ConcurrentExpiringSet <string>(); set.AddOrUpdate("testKey1", DateTime.UtcNow + TimeSpan.FromSeconds(5)); set.Close(); Assert.Throws <ObjectDisposedException>(() => set.AddOrUpdate("testKey2", DateTime.UtcNow - TimeSpan.FromSeconds(5))); }