Ejemplo n.º 1
0
        private LandmarkService GetLandmarkService(ILandmarkRepository landmarkRepository = null)
        {
            AutoMapperConfiguration.Configure();

            landmarkRepository = landmarkRepository ?? new Mock <ILandmarkRepository>().Object;
            return(new LandmarkService(landmarkRepository));
        }
        public LandmarkRepositoryTest()
        {
            var services = new ServiceCollection();

            services.AddDbContext <NYCLandmarkContext>(options =>
                                                       options.UseNpgsql(@"User ID=nyclandmarks;Password=nyclandmarks;Server=192.168.99.100;Port=5432;Database=nyclandmarks;Integrated Security=true;Pooling=true;"));

            services.AddScoped <ILandmarkRepository, LandmarkRepository>();
            serviceProvider = services.BuildServiceProvider();

            dbContext          = serviceProvider.GetRequiredService <NYCLandmarkContext>();
            landmarkRepository = serviceProvider.GetRequiredService <ILandmarkRepository>();
        }
Ejemplo n.º 3
0
        public LandmarkRepositoryTest()
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json")
                          .Build();

            var dbonnection = builder.GetConnectionString("SqlServer");

            var serviceProvider = new ServiceCollection()
                                  .AddDbContext <NYCLandmarkContext>(options => options.UseSqlServer(dbonnection))
                                  .AddScoped <ILandmarkRepository, LandmarkRepository>()
                                  .BuildServiceProvider();

            serviceProvider.GetRequiredService <SqlServer.NYCLandmarkContext>();

            _dbContext          = serviceProvider.GetRequiredService <NYCLandmarkContext>();
            _landmarkRepository = serviceProvider.GetRequiredService <ILandmarkRepository>();
        }
 public LandmarkRepositoryTest(CoreDataStoreDbFixture fixture, ITestOutputHelper output)
 {
     _landmarkRepository = fixture.LandmarkRepository;
     _output             = output;
 }
Ejemplo n.º 5
0
 public LandmarkController(ILandmarkRepository landMarkRepository)
 {
     _landMarkRepository = landMarkRepository;
 }
Ejemplo n.º 6
0
 public UsersController(ILogger <UsersController> logger, ILandmarkRepository landmarkRepository)
 {
     _logger             = logger;
     _landmarkRepository = landmarkRepository;
 }
Ejemplo n.º 7
0
 public LandmarkDataService(ILandmarkRepository landmarkRepository)
 {
     _landmarkRepository = landmarkRepository;
 }
Ejemplo n.º 8
0
 public HomeController(ILandmarkRepository landmarkRepository)
 {
     _landmarkRepository = landmarkRepository;
 }
Ejemplo n.º 9
0
 public LandmarkService(ILandmarkRepository landmarkRepository)
 {
     _landmarkRepository = landmarkRepository ?? throw new ArgumentNullException(nameof(landmarkRepository));
 }
Ejemplo n.º 10
0
 public LandmarkService(ILandmarkRepository landmarktRepository)
 {
     this._landmarktRepository = landmarktRepository;
 }
Ejemplo n.º 11
0
 public LandmarkService(ILandmarkRepository landmarkRepository, IUnitOfWork unitOfWork)
 {
     this._landmarkRepository = landmarkRepository;
     this._unitOfWork         = unitOfWork;
 }