public void ItShouldFactorAClassWithoutAPublicConstructor() { // Act ClassWithoutAPublicConstructor actual = GetService <ClassWithoutAPublicConstructor>(); // Assert actual .Should() .NotBeNull() .And.BeSameAs(ExpectedNoPublicConstructor); }
public WhenFactoringClassesWithInvalidConstructorsWithoutAContext(ITestOutputHelper output) { ExpectedNoPublicConstructor = ClassWithoutAPublicConstructor.Create(); ExpectedMultiplePublicConstructors = new ClassWithMultiplePublicConstructors(); _container = new RegistrationSetup() .RegisterFactory(() => ExpectedNoPublicConstructor) .RegisterFactory(() => ExpectedMultiplePublicConstructors) .Construct(GetType().GetTypeInfo().Assembly, out string code); output.WriteLine(code); }
public ClassWithMultiplePublicConstructors(ClassWithoutAPublicConstructor other) { Other = other; }
public ClassWithMultiplePublicConstructors() : this(ClassWithoutAPublicConstructor.Create()) { }