コード例 #1
0
        public void Test_Ctor()
        {
            AddOnlySet <string> addOnlySet;

            addOnlySet = new AddOnlySet <string>();

            Assert.That(addOnlySet, Has.Count.EqualTo(0));
        }
コード例 #2
0
 /// <summary>
 /// Create a new <see cref="CacheContextEntry"/>.
 /// </summary>
 public CacheContextEntry()
 {
     Entities          = new AddOnlySet <long>( );
     RelationshipTypes = new AddOnlySet <long>( );
     FieldTypes        = new AddOnlySet <long>( );
     EntityInvalidatingRelationshipTypes = new AddOnlySet <long>( );
     EntityTypes = new AddOnlySet <long>( );
 }
コード例 #3
0
        public void Test_AddSingle()
        {
            AddOnlySet <string> addOnlySet;

            addOnlySet = new AddOnlySet <string>();
            addOnlySet.Add("foo");

            Assert.That(addOnlySet, Has.Exactly(1).EqualTo("foo"));
        }
コード例 #4
0
        public void Test_AddMultiple()
        {
            AddOnlySet <string> addOnlySet;

            addOnlySet = new AddOnlySet <string>();
            addOnlySet.Add("foo", "bar");

            Assert.That(addOnlySet, Has.Count.EqualTo(2));
            Assert.That(addOnlySet, Has.Exactly(1).EqualTo("foo"));
            Assert.That(addOnlySet, Has.Exactly(1).EqualTo("bar"));
        }
コード例 #5
0
        public void Test_ItemsAddedDuplicateInList()
        {
            AddOnlySet <string> addOnlySet;
            List <string>       itemsAdded;

            itemsAdded             = new List <string>();
            addOnlySet             = new AddOnlySet <string>();
            addOnlySet.ItemsAdded += (sender, args) => itemsAdded.AddRange(args.Items);

            addOnlySet.Add("foo", "foo");

            Assert.That(itemsAdded, Is.EquivalentTo(new[] { "foo" }));
        }
コード例 #6
0
        public void Test_ItemsAddedDuplicateInSet()
        {
            AddOnlySet <string> addOnlySet;
            List <string>       itemsAdded;

            itemsAdded = new List <string>();
            addOnlySet = new AddOnlySet <string>();
            addOnlySet.Add("foo");

            addOnlySet.ItemsAdded += (sender, args) => itemsAdded.AddRange(args.Items);

            addOnlySet.Add("foo");

            Assert.That(itemsAdded, Is.Empty);
        }