Example #1
0
        public void Should_be_able_to_retrieve_an_object_that_has_been_added_to_the_map()
        {
            IIdentityMap <IDomainObject> map = CreateSUT( );
            IDomainObject objectAddedToMap   = new DomainObject(1);

            map.Add(objectAddedToMap);

            Assert.AreEqual(objectAddedToMap, map.FindObjectWithIdOf(1));
        }
Example #2
0
        public void Should_check_identity_map_to_see_if_customer_is_loaded()
        {
            ICustomer customer   = _mockery.DynamicMock <ICustomer>( );
            long      customerId = 23455;

            using (_mockery.Record( )) {
                Expect.Call(_mockIdentityMap.ContainsObjectWithIdOf(customerId)).Return(true);
                Expect.Call(_mockIdentityMap.FindObjectWithIdOf(customerId)).Return(customer);
            }

            using (_mockery.Playback( )) {
                Assert.AreEqual(customer, CreateSUT( ).FindBy(customerId));
            }
        }