Example #1
0
        public void RegistrationForCreatedType_IsHandled()
        {
            var createdServiceTypes = new HashSet <Type> {
                typeof(TestConcreteClass)
            };
            var handler       = new MoqRegistrationHandler(createdServiceTypes, new HashSet <Type>());
            var registrations = handler.RegistrationsFor(new TypedService(typeof(TestConcreteClass)), s => Enumerable.Empty <ServiceRegistration>());

            Assert.NotEmpty(registrations);

            createdServiceTypes.Add(typeof(TestAbstractClass));
            registrations = handler.RegistrationsFor(new TypedService(typeof(TestAbstractClass)), s => Enumerable.Empty <ServiceRegistration>());

            Assert.NotEmpty(registrations);
        }
        public void RegistrationForCreatedType_IsNotHandled()
        {
            var createdServiceTypes = new List <Type> {
                typeof(TestConcreteClass)
            };
            var handler       = new MoqRegistrationHandler(createdServiceTypes);
            var registrations = handler.RegistrationsFor(new TypedService(typeof(TestConcreteClass)), null);

            Assert.Empty(registrations);

            createdServiceTypes.Add(typeof(TestAbstractClass));
            registrations = handler.RegistrationsFor(new TypedService(typeof(TestAbstractClass)), null);

            Assert.Empty(registrations);
        }