Ejemplo n.º 1
0
 public ShellViewModel(ISomeRepository repository, IConfirmer confirmer)
 {
     if (confirmer == null)
     {
         throw new ArgumentNullException("confirmer");
     }
     _confirmer = confirmer;
Ejemplo n.º 2
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, ISomeRepository someRepository)
 {
     app.UseIISPlatformHandler();
     app.Run(async(context) =>
     {
         await context.Response.WriteAsync($"Hello World from {nameof(someRepository)}!");
     });
 }
Ejemplo n.º 3
0
        public void DoStuff_GivenStuff_ExpectedStuff()
        {
            //Arrange
            ISomeRepository      repository = A.Fake <ISomeRepository>();
            ISomeClient          client     = A.Fake <ISomeClient>();
            ISomeLogger          logger     = A.Fake <ISomeLogger>();
            IImprovedSomeService service    = new DependencyInjectionMakesUnitTestingSimple.ImprovedSomeService(repository,
                                                                                                                client,
                                                                                                                logger);
            //Act
            var result = service.DoStuff();

            //Assert
            A.CallTo(() => repository.WriteStuffToDb()).MustHaveHappened();
            A.CallTo(() => client.SomeCallToWebService()).MustHaveHappened();
            A.CallTo(() => logger.LogStuff()).MustHaveHappened();
            Assert.True(result);
        }
Ejemplo n.º 4
0
        public ImprovedSomeService(ISomeRepository someRepository,
                                   ISomeClient someClient,
                                   ISomeLogger someLogger)
        {
            if (someRepository == null)
            {
                throw new ArgumentNullException(nameof(someRepository));
            }
            if (someClient == null)
            {
                throw new ArgumentNullException(nameof(someClient));
            }
            if (someLogger == null)
            {
                throw new ArgumentNullException(nameof(someLogger));
            }

            this.SomeRepository = someRepository;
            this.SomeClient     = someClient;
            this.SomeLogger     = someLogger;
        }
        public ImprovedSomeService(ISomeRepository someRepository,
            ISomeClient someClient,
            ISomeLogger someLogger)
        {
            if (someRepository == null)
            {
                throw new ArgumentNullException(nameof(someRepository));
            }
            if (someClient == null)
            {
                throw new ArgumentNullException(nameof(someClient));
            }
            if (someLogger == null)
            {
                throw new ArgumentNullException(nameof(someLogger));
            }

            this.SomeRepository = someRepository;
            this.SomeClient = someClient;
            this.SomeLogger = someLogger;
        }
Ejemplo n.º 6
0
 public SomeService(ISomeRepository someRepository, IDependency1 dependency1, IDependency2 dependency2)
 {
     SomeRepository = someRepository;
     Dependency1    = dependency1;
     Dependency2    = dependency2;
 }
 public RepositoryUsingService(ISomeRepository repository, ILogger <RepositoryUsingService> logger)
 {
     _repository = repository;
     _logger     = logger;
 }
Ejemplo n.º 8
0
 public SomeService([BeanReference] ISomeRepository repo)
 {
     repo.Init("myConnection");
     _repo = repo;
 }
 public SomeService(ISomeRepository iaRepository, IMapper mapper, ILogger <SomeService> logger)
 {
     _iaRepository = iaRepository ?? throw new ArgumentNullException(nameof(iaRepository));
     _mapper       = mapper ?? throw new ArgumentNullException(nameof(mapper));
     _logger       = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Ejemplo n.º 10
0
 public SomeService(ISomeRepository repository)
 {
 }
 public GreeterServiceImpl(ISomeRepository someRepository)
 {
     _someRepository = someRepository;
 }
Ejemplo n.º 12
0
 public SomeService(ISomeRepository repository)
 {
 }
 public SomeController(ISomeRepository repository)
 {
     this.repository = repository;
 }