public void Use_static_factory_method_creates_object_by_static_method_with_1_parameter_call() { const string expectedText1 = "some text"; _ctx.RegisterDefault <ComplexType>() .UseStaticFactoryMethod((string text) => ComplexTypeFactory.CreateInstance(text)) .BindMethodArg().ToValue(expectedText1); Assert.That(_ctx.GetDefaultObject <ComplexType>().Text, Is.EqualTo(expectedText1)); }
public void Use_static_factory_method_creates_object_by_static_method_with_3_parameters_call() { const string expectedText1 = "some text"; const string expectedText2 = "some text2"; const int expectedValue = 66; _ctx.RegisterDefault <ComplexType>() .UseStaticFactoryMethod((string text, string text2, int value) => ComplexTypeFactory.CreateInstance(text, text2, value)) .BindMethodArg().ToValue(expectedText1) .BindMethodArg().ToValue(expectedText2) .BindMethodArg().ToValue(expectedValue); Assert.That(_ctx.GetDefaultObject <ComplexType>().Text, Is.EqualTo(expectedText1)); Assert.That(_ctx.GetDefaultObject <ComplexType>().Simple.Text, Is.EqualTo(expectedText2)); Assert.That(_ctx.GetDefaultObject <ComplexType>().Simple.Value, Is.EqualTo(expectedValue)); }