Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public void Test_AddSingle()
        {
            AddOnlySet <string> addOnlySet;

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

            Assert.That(addOnlySet, Has.Exactly(1).EqualTo("foo"));
        }
Exemplo n.º 3
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"));
        }
Exemplo n.º 4
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" }));
        }