public void It_throws_exception_when_trying_to_put_objects_with_same_id()
        {
            var objectId = ObjectId.NewUniqueId();
            var map = new ObjectIdentityMap();
            map.Put(objectId, new object());

            Assert.Throws<InvalidOperationException>(() => map.Put(objectId, new object()));
        }
示例#2
0
        public void It_throws_exception_when_trying_to_put_objects_with_same_id()
        {
            var objectId = ObjectId.NewUniqueId();
            var map      = new ObjectIdentityMap();

            map.Put(objectId, new object());

            Assert.Throws <InvalidOperationException>(() => map.Put(objectId, new object()));
        }
        public void It_returns_object_by_its_id()
        {
            var objectId = ObjectId.NewUniqueId();
            var o = new object();
            var map = new ObjectIdentityMap();

            map.Put(objectId, o);
            var existing = map.GetById(objectId);

            Assert.AreSame(o, existing);
        }
示例#4
0
        public void It_returns_object_by_its_id()
        {
            var objectId = ObjectId.NewUniqueId();
            var o        = new object();
            var map      = new ObjectIdentityMap();

            map.Put(objectId, o);
            var existing = map.GetById(objectId);

            Assert.AreSame(o, existing);
        }