public void GetConstructor_WithNullArgument2_ThrowsException() { // Arrange var behavior = new ContainerOptions().ConstructorResolutionBehavior; // Act behavior.GetConstructor(typeof(TypeWithSinglePublicDefaultConstructor), null); }
public void GetConstructor_WithNullArgument1_ThrowsException() { // Arrange var behavior = new ContainerOptions().ConstructorResolutionBehavior; // Act Action action = () => behavior.GetConstructor(null, typeof(TypeWithSinglePublicDefaultConstructor)); // Assert AssertThat.Throws <ArgumentNullException>(action); }
public void IsRegistrationPhase_InstancesResolvedFromTheContainer_ReturnsFalse() { // Arrange var behavior = new ContainerOptions().ConstructorResolutionBehavior; // Act var constructor = behavior.GetConstructor(typeof(TypeWithSinglePublicDefaultConstructor), typeof(TypeWithSinglePublicDefaultConstructor)); // Assert Assert.IsNotNull(constructor, "The constructor was expected to be returned."); }
public void GetConstructor_TypeWithSingleInternalConstructor_ThrowsExpectedException() { // Arrange var behavior = new ContainerOptions().ConstructorResolutionBehavior; try { // Act behavior.GetConstructor(typeof(TypeWithSingleInternalConstructor), typeof(TypeWithSingleInternalConstructor)); // Assert Assert.Fail("Exception expected."); } catch (ActivationException ex) { AssertThat.StringContains("For the container to be able to create " + "DefaultConstructorResolutionBehaviorTests.TypeWithSingleInternalConstructor, it should " + "contain exactly one public constructor, but it has 0.", ex.Message); } }