Пример #1
0
        public void GetLocationShouldPulNo()
        {
            var options = new DbContextOptionsBuilder <ZipDbContext>()
                          .UseInMemoryDatabase(databaseName: "my_db")
                          .Options;

            string zip  = "90403";
            string name = "LA";
            string alt  = "54321";

            // Run the test against one instance of the context
            using (var context = new ZipDbContext(options))
            {
                context.Cbsas.Add(new CbsaEntity
                {
                    Zip  = zip,
                    Cbsa = "12345"
                });

                context.Msas.Add(new MsaEntity
                {
                    Cbsa            = alt,
                    Mdiv            = "12345",
                    Lsad            = "Metropolitan Statistical Area",
                    PopEstimate2014 = "100",
                    PopEstimate2015 = "200",
                    Name            = name
                });

                context.SaveChanges();

                LocationService service = new LocationService(context);

                List <Location> locationData = service.GetLocationData(zip);

                Assert.True(locationData.Any(x => x.Cbsa == alt));
            }
        }
Пример #2
0
 public GetAllUsersQueryHandler(ZipDbContext zipDbContext, IMapper mapper)
 {
     _zipDbContext = zipDbContext;
     _mapper       = mapper;
 }
Пример #3
0
 public UsersController(ZipDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
 public CreateUserCommandHandler(ZipDbContext dbContext, IMapper mapper)
 {
     _dbContext = dbContext;
     _mapper    = mapper;
 }
Пример #5
0
 public GetUserQueryHandler(ZipDbContext dbContext, IMapper mapper)
 {
     _dbContext = dbContext;
     _mapper    = mapper;
 }
Пример #6
0
 public AccountRepository(ZipDbContext context)
 {
     Context = context ?? throw new ArgumentNullException(nameof(context));
 }
Пример #7
0
 public void Setup()
 {
     Context = new ZipDbContext(new DbContextOptionsBuilder().UseInMemoryDatabase("zip.db").Options);
 }
Пример #8
0
 public DataLoadingService(ZipDbContext context)
 {
     _context = context;
 }
Пример #9
0
 public AccountsController(ZipDbContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Пример #10
0
 public LocationService(ZipDbContext context)
 {
     _context = context;
 }