コード例 #1
0
        public void TestSetEquals()
        {
            var builder = FastImmutableHashSet.CreateBuilder <int>();

            builder.UnionWith(new[] { 1, 2, 3, 4 });
            Assert.True(builder.MoveToImmutable().SetEquals(new [] { 4, 3, 2, 1 }.ToFastImmutableHashSet()));
        }
コード例 #2
0
        public void TestContains()
        {
            var builder = FastImmutableHashSet.CreateBuilder <int>();

            builder.UnionWith(new[] { 1, 2, 3, 4 });
            var hashSet = builder.MoveToImmutable();

#pragma warning disable xUnit2017 // Do not use Contains() to check if a value exists in a collection
            Assert.True(hashSet.Contains(3));
            Assert.False(hashSet.Contains(5));
#pragma warning restore xUnit2017 // Do not use Contains() to check if a value exists in a collection
        }