public void ConstructorRequires_TypeNotNull() { Assertions.AssertThrows <ArgumentNullException>(delegate { new TypedService(null); }); }
public void NullIsNotAValidInstance() { Assertions.AssertThrows <ArgumentNullException>(delegate { new ProvidedInstanceActivator(null); }); }
public void ContructorRequires_KeyNotNull() { Assertions.AssertThrows <ArgumentNullException>(delegate { new KeyedService(null, typeof(object)); }); }
public void Constructor_DetectsNullsAmongServices() { Assertions.AssertThrows <ArgumentException>(delegate { var services = new Service[] { new TypedService(typeof(object)), null }; Factory.CreateSingletonRegistration(services, Factory.CreateProvidedInstanceActivator(new object())); }); }
public void Constructor_DoesNotAcceptNullSelector() { Assertions.AssertThrows <ArgumentNullException>(delegate { new ReflectionActivator(typeof(object), new Mock <IConstructorFinder>().Object, null, Factory.NoParameters, Factory.NoProperties); }); }
public void ActivatingAProvidedInstanceTwice_RaisesException() { object instance = new object(); ProvidedInstanceActivator target = new ProvidedInstanceActivator(instance); target.ActivateInstance(Factory.EmptyContainer, Factory.NoParameters); Assertions.AssertThrows <InvalidOperationException>(delegate { target.ActivateInstance(Factory.EmptyContainer, Factory.NoParameters); }); }
public void Register_DoesNotAcceptNull() { var registry = new ComponentRegistry(); Assertions.AssertThrows <ArgumentNullException>(() => registry.Register(null)); }
public void FindsEmptyElementInList() { Assertions.AssertThrows <ArgumentException>(() => Enforce.ArgumentElementNotNull(new object[] { null }, "arg")); }