Example #1
0
        public void Given_constructor_with_two_parameters_Resolving_Func_twice_with_one_BUT_different_parameter_should_work()
        {
            var container = new Container();

            container.Register(typeof(ServiceWithTwoParameters));
            container.Register(typeof(Service));
            container.Register(typeof(AnotherService), typeof(AnotherService));

            var firstFunc = container.Resolve <Func <Service, ServiceWithTwoParameters> >();
            var one       = new Service();
            var first     = firstFunc(one);

            Assert.That(first.One, Is.SameAs(one));

            var secondFunc = container.Resolve <Func <AnotherService, ServiceWithTwoParameters> >();
            var another    = new AnotherService();
            var second     = secondFunc(another);

            Assert.That(second.Another, Is.SameAs(another));
        }
 public CheckWithServiceDependency(AnotherService _)
 {
 }
 public AConsumer(AService service, AnotherService anotherService)
 {
     Service        = service;
     AnotherService = anotherService;
 }
 public Job(SomeService someService, AnotherService anotherService)
 {
     SomeService    = someService;
     AnotherService = anotherService;
 }
 public ExampleService(AnotherService anotherService) =>
 this.anotherService = anotherService;
Example #6
0
 //if both services registered in DI then this is used
 public MultiConstructorController(AService aService, AnotherService anotherService)
 {
     _aService           = aService;
     _anotherService     = anotherService;
     this.constuctorused = "constructor 2 used";
 }
 public AConsumer(AService service, AnotherService anotherService)
 {
     Service = service;
     AnotherService = anotherService;
 }
Example #8
0
 public ServiceWithTwoParameters(Service one, AnotherService another)
 {
     One     = one;
     Another = another;
 }