示例#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);
        }