public void UnsafeHashSet_Full_Throws() { var container = new UnsafeHashSet <int>(16, Allocator.Temp); ExpectedCount(ref container, 0); for (int i = 0, capacity = container.Capacity; i < capacity; ++i) { Assert.DoesNotThrow(() => { container.Add(i); }); } ExpectedCount(ref container, container.Capacity); // Make sure overallocating throws and exception if using the Concurrent version - normal hash map would grow var writer = container.AsParallelWriter(); Assert.Throws <System.InvalidOperationException>(() => { writer.Add(100); }); ExpectedCount(ref container, container.Capacity); container.Clear(); ExpectedCount(ref container, 0); container.Dispose(); }