public void SetUp()
 {
     _key1 = new ConstructorForAssembledTypeCacheKey(typeof(int), typeof(Action), true);
     _key2 = new ConstructorForAssembledTypeCacheKey(typeof(Random), typeof(Action), true);
     _key3 = new ConstructorForAssembledTypeCacheKey(typeof(int), typeof(Func <int>), true);
     _key4 = new ConstructorForAssembledTypeCacheKey(typeof(int), typeof(Action), false);
     _key5 = new ConstructorForAssembledTypeCacheKey(typeof(int), typeof(Action), true);
 }
        public void GetOrCreateConstructorCall_CacheMiss()
        {
            var requestedType = ReflectionObjectMother.GetSomeType();

            _typeAssemblerMock.Expect(mock => mock.GetRequestedType(_assembledType)).Return(requestedType);

            _constructorDelegateFactoryMock
            .Expect(mock => mock.CreateConstructorCall(requestedType, _assembledType, _delegateType, _allowNonPublic))
            .Return(_generatedCtorCall);

            var result = _cache.GetOrCreateConstructorCall(_assembledType, _delegateType, _allowNonPublic);

            _constructorDelegateFactoryMock.VerifyAllExpectations();
            Assert.That(result, Is.SameAs(_generatedCtorCall));

            var reverseConstructionKey = new ConstructorForAssembledTypeCacheKey(_assembledType, _delegateType, _allowNonPublic);

            Assert.That(_constructorCalls[reverseConstructionKey], Is.SameAs(_generatedCtorCall));
        }