public void MultiCtors_WithNewInstance_UsesEmptyCtor() { var sp = new ActivatorServiceProvider(); var result = Reflect.Type <TwoCtorStub>() .WithNewInstance() .GetMethod(nameof(TwoCtorStub.GetValue)) .Invoke(new ParamStub1(), new ParamStub2()); Assert.Equal("EmptyCtor_ParamStub1Value_ParamStub2Value_", result); }
public void MutiCtors_SpecifiedCtorWithServiceProvider_UsesCorrectCtor() { var sp = new ActivatorServiceProvider(); var result = Reflect.Type <TwoCtorStub>() .WithNewInstance() .UsingConstructor <ParamStub1>() .WithArgumentsFromServiceProvider(sp) .GetMethod(nameof(TwoCtorStub.GetValue)) .Invoke(new ParamStub1(), new ParamStub2()); Assert.Equal("ParamCtor_ParamStub1Value_ParamStub2Value_", result); }
public void MultiCtors_WithNewInstanceWithMethodParametersFromProvider_UsesEmptyCtor() { var sp = new ActivatorServiceProvider(); var result = Reflect.Type <TwoCtorStub>() .WithNewInstance() .GetMethod(nameof(TwoCtorStub.GetValue)) .WithParameters <ParamStub1, ParamStub2>() .FromServiceProvider(sp) .Invoke(); Assert.Equal("EmptyCtor_ParamStub1Value_ParamStub2Value_", result); }