コード例 #1
0
        public void RemoveNonExisting()
        {
            var lookup = new MutableLookup <string, string>();

            lookup.Add(null, "blah");
            lookup.Add(null, "monkeys");
            lookup.Add("F", "Foo");
            lookup.Add("F", "Foobar");
            lookup.Add("B", "Bar");

            Assert.IsFalse(lookup.Remove("D"));
            Assert.AreEqual(3, lookup.Count);

            Assert.IsFalse(lookup.Remove("F", "asdf"));
            Assert.AreEqual(3, lookup.Count);

            lookup.Remove(null);
            Assert.IsFalse(lookup.Remove(null));
            Assert.AreEqual(2, lookup.Count);
        }
コード例 #2
0
        public void CountValueType()
        {
            var lookup = new MutableLookup <int, int>();

            Assert.AreEqual(0, lookup.Count);
            lookup.Add(1, 10);
            Assert.AreEqual(1, lookup.Count);
            lookup.Add(2, 20);
            Assert.AreEqual(2, lookup.Count);
            lookup.Add(2, 21);
            Assert.AreEqual(2, lookup.Count);

            lookup.Remove(1, 10);
            Assert.AreEqual(1, lookup.Count);
        }
コード例 #3
0
        public void CountRefType()
        {
            var lookup = new MutableLookup <string, string>();

            Assert.AreEqual(0, lookup.Count);
            lookup.Add(null, "blah");
            Assert.AreEqual(1, lookup.Count);
            lookup.Add("F", "Foo");
            Assert.AreEqual(2, lookup.Count);
            lookup.Add("F", "Foobar");
            Assert.AreEqual(2, lookup.Count);

            lookup.Remove(null, "blah");
            Assert.AreEqual(1, lookup.Count);
        }
コード例 #4
0
ファイル: MutableLookupTest.cs プロジェクト: strager/Tempest
        public void RemoveNonExisting()
        {
            var lookup = new MutableLookup<string, string>();
            lookup.Add(null, "blah");
            lookup.Add(null, "monkeys");
            lookup.Add("F", "Foo");
            lookup.Add("F", "Foobar");
            lookup.Add("B", "Bar");

            Assert.IsFalse (lookup.Remove ("D"));
            Assert.AreEqual(3, lookup.Count);

            Assert.IsFalse (lookup.Remove ("F", "asdf"));
            Assert.AreEqual(3, lookup.Count);

            lookup.Remove (null);
            Assert.IsFalse (lookup.Remove (null));
            Assert.AreEqual (2, lookup.Count);
        }
コード例 #5
0
ファイル: MutableLookupTest.cs プロジェクト: strager/Tempest
        public void CountValueType()
        {
            var lookup = new MutableLookup<int, int>();
            Assert.AreEqual (0, lookup.Count);
            lookup.Add (1, 10);
            Assert.AreEqual (1, lookup.Count);
            lookup.Add (2, 20);
            Assert.AreEqual (2, lookup.Count);
            lookup.Add (2, 21);
            Assert.AreEqual (2, lookup.Count);

            lookup.Remove (1, 10);
            Assert.AreEqual(1, lookup.Count);
        }
コード例 #6
0
ファイル: MutableLookupTest.cs プロジェクト: strager/Tempest
        public void CountRefType()
        {
            var lookup = new MutableLookup<string, string>();
            Assert.AreEqual (0, lookup.Count);
            lookup.Add (null, "blah");
            Assert.AreEqual (1, lookup.Count);
            lookup.Add ("F", "Foo");
            Assert.AreEqual (2, lookup.Count);
            lookup.Add ("F", "Foobar");
            Assert.AreEqual (2, lookup.Count);

            lookup.Remove (null, "blah");
            Assert.AreEqual (1, lookup.Count);
        }