public void InjectsMethod(SingletonDependency dependency1, SingletonDependency dependency2)
        {
            Assert.NotNull(dependency1);
            Assert.NotNull(dependency2);
            Assert.AreEqual(dependency1, dependency2);

            Assert.AreEqual(dependency1, Dependency1);
        }
Beispiel #2
0
 // private readonly ScopedDependency _scopedDependency;
 public WeatherForecastController(ILogger <WeatherForecastController> logger,
                                  SingletonDependency singletonDependency
                                  //  ,ScopedDependency scopedDependency
                                  )
 {
     _logger = logger;
     this._singletonDependency = singletonDependency;
     // this._scopedDependency = scopedDependency;
 }
Beispiel #3
0
 public Job(ScopedDependency scopedDependency1, ScopedDependency scopedDependency2, TransientDependency transientDependency1, TransientDependency transientDependency2, SingletonDependency singletonDependency1, SingletonDependency singletonDependency2)
 {
     ScopedDependency1    = scopedDependency1;
     ScopedDependency2    = scopedDependency2;
     TransientDependency1 = transientDependency1;
     TransientDependency2 = transientDependency2;
     SingletonDependency1 = singletonDependency1;
     SingletonDependency2 = singletonDependency2;
 }
Beispiel #4
0
        private void InstallNonDisposingServices(IServiceCollection services)
        {
            services.AddScoped <MyCoolService>()
            .AddScoped <MyOtherCoolService>();

            var singleton = new SingletonDependency();

            services.AddSingleton <SingletonDependency>(singleton)
            .AddScoped <ScopedDependency>()
            .AddTransient <TransientDependency>();
        }
Beispiel #5
0
        public SingletonDependencyShould()
        {
            _contract = typeof(IBooRepository);

            var resolver = MockResolver(_contract, (type, scope) =>
            {
                _instance = new Mock <IDisposable>().As <IBooRepository>();
                return(_instance.Object);
            });

            _dependency = new SingletonDependency(new[] { _contract }, resolver.Object);

            _services = Mock.Of <IServiceProvider>();
        }
Beispiel #6
0
 public TestExceptionFilter(SingletonDependency singletonDependency)
 {
     _singletonDependency = singletonDependency;
 }
Beispiel #7
0
 public TestResultFilter(SingletonDependency singletonDependency)
 {
     _singletonDependency = singletonDependency;
 }
 public SingletonTests(SingletonDependency dependency1, SingletonDependency dependency2)
 {
     Dependency1 = dependency1;
     Dependency2 = dependency2;
 }
 public DependencyRootMixed(Dependency _, Dependency __, SingletonDependency ___, SingletonDependency ____)
 {
 }
Beispiel #10
0
 public DependencyRootWithSingletons(SingletonDependency _, SingletonDependency __)
 {
 }
Beispiel #11
0
 public RandomNumberJob(ILogger <RandomNumberJob> logger, SingletonDependency singletonDependency)
 {
     _logger = logger;
     _singletonDependency = singletonDependency;
 }
 public CaptiveDependencyTestController(SingletonDependency singletonDependecy)
 {
     this.singletonDependecy = singletonDependecy;
 }