Esempio n. 1
0
        public void TestHashMapContains()
        {
            var orders = new Customized32HashedMap <string, Order>();
            var key    = Guid.NewGuid().ToString();
            var order  = new Order();

            orders.Add(key, order);
            Assert.True(orders.ContainsKey(key));
        }
Esempio n. 2
0
        public void TestMapNullExceptions()
        {
            var  map = new Customized32HashedMap <Order, Bill>();
            Bill b;

            Assert.Throws(typeof(ArgumentNullException), () => map.Add(null, null));
            Assert.Throws(typeof(ArgumentNullException), () => map[null] = null);
            Assert.Throws(typeof(ArgumentNullException), () => { var v = map[null]; });
            Assert.Throws(typeof(ArgumentNullException), () => map.Remove(null));
            Assert.Throws(typeof(ArgumentNullException), () => map.TryGetValue(null, out b));
            Assert.Throws(typeof(ArgumentNullException), () => map.ContainsKey(null));
            Assert.Throws(typeof(ArgumentNullException), () => map.CopyTo(null, 0));

            var simpleMap = new Customized32HashedMap <int, string>();

            simpleMap.Add(0, null);
        }