public void Init()
        {
            this.ConfigureMapper();
            this.cars = new List <Car>()
            {
                new Car()
                {
                    Id    = 1,
                    Price = 20,
                    Name  = "Volga"
                },
                new Car()
                {
                    Id    = 2,
                    Price = 30,
                    Name  = "Chaika"
                }
            };

            this._context = new FakeCarsDbContext();
            foreach (var car in cars)
            {
                this._context.Cars.Add(car);
            }

            HttpConfiguration config = new HttpConfiguration();

            this._service    = new CarsService(this._context);
            this._controller = new CarsController(this._service);
            this._controller.Configuration = config;
        }
コード例 #2
0
        public UnitOfWork(ICarsDbContext dbContext)
        {
            if (dbContext == null)
            {
                throw new ArgumentNullException("Db context cannot be null");
            }

            this.dbContext = dbContext;
        }
コード例 #3
0
ファイル: Repository.cs プロジェクト: simonaTsenova/Cars
        public Repository(ICarsDbContext dbContext)
        {
            if (dbContext == null)
            {
                throw new ArgumentNullException("Db context cannot be null.");
            }

            this.dbContext = dbContext;
        }
コード例 #4
0
 public Service(ICarsDbContext context)
 {
     this.Context = context;
 }
コード例 #5
0
ファイル: QueryXmlParser.cs プロジェクト: didimitrov/Algo
 public QueryXmlParser(ICarsDbContext carsContext)
 {
     this.carsContext = carsContext;
 }
コード例 #6
0
ファイル: DataJsonImporter.cs プロジェクト: didimitrov/Algo
 public DataJsonImporter(ICarsDbContext carsContext)
 {
     this._carsContext = carsContext;
 }
コード例 #7
0
 public CarsService(ICarsDbContext cars)
     : base(cars)
 {
 }