Example #1
0
        public void Resolving_unregistered_property_without_attribute_model_should_not_throw_so_the_property_stays_null()
        {
            var container = new Container();

            container.Register <Service>();

            var client = new NamedPropertyClient();

            container.InjectPropertiesAndFields(client);

            Assert.That(client.Some, Is.Null);
        }
Example #2
0
        public void Resolving_unregistered_property_marked_by_Import_should_throw()
        {
            var container = new Container().WithMefAttributedModel();

            container.RegisterExports(typeof(Service));

            var client = new NamedPropertyClient();

            Assert.Throws <ContainerException>(() =>
                                               container.InjectPropertiesAndFields(client));

            Assert.That(client.Some, Is.Null);
        }