示例#1
0
        public ServiceTest()
        {
            var opb = new DbContextOptionsBuilder();

            opb.UseInMemoryDatabase("ClosestFriendLocation");

            _closestFriendLocationContext = new ClosestFriendLocationContext(opb.Options);

            _friendRepository = new FriendRepository(_closestFriendLocationContext);

            _locationService = new FriendService(_friendRepository);

            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <AddressModel, Address>();
                cfg.CreateMap <FriendModel, Friend>();
                cfg.CreateMap <LocationModel, Location>();

                cfg.CreateMap <Address, AddressModel>();
                cfg.CreateMap <Friend, FriendModel>();
                cfg.CreateMap <Location, LocationModel>();
            });

            _mapper = config.CreateMapper();
        }
示例#2
0
 public Repository(ClosestFriendLocationContext context)
 {
     _context = context;
 }
示例#3
0
 public FriendRepository(ClosestFriendLocationContext context) : base(context)
 {
     _context = context;
 }