public void GetAllBrandsByRepositoryTest()
        {
            brandRepository.GetAll().Returns(brandList);
            var result = brandRepository.GetAll().ToList();

            Assert.IsTrue(result.Count > 0);
        }
Exemplo n.º 2
0
        private void LoadModel()
        {
            _file = new FileInfo(Application.StartupPath + @"\\Vehicle.xlsx");

            using (var package = new ExcelPackage(_file))
            {
                var workbook = package.Workbook;

                using (var tx = NHibernateSessionManager.GetLocalSession().BeginTransaction())
                {
                    var ws     = workbook.Worksheets[@"Model"];
                    var brands = _vehicleBrandRepository.GetAll();

                    for (var i = 1; i < ws.Dimension.End.Row + 1; i++)
                    {
                        VehicleSize size;

                        Enum.TryParse(ws.Cells[i, 3].Value.ToString(), out size);

                        var newModel = new VehicleModel(
                            ws.Cells[i, 1].Value.ToString(),
                            ws.Cells[i, 2].Value.ToString(),
                            brands.FirstOrDefault(x => x.Code == ws.Cells[i, 3].Value.ToString()),
                            size,
                            VehicleType.CAR
                            );

                        _vehicleModelRepository.Insert(newModel);
                    }

                    tx.Commit();
                }
            }
        }
Exemplo n.º 3
0
 public void SetForm(Add view)
 {
     _view = view;
     _view.CustomerCode = string.Format("C{0}{1:00}",
                                        LoginService.LoggedInUserBranch.Code.Substring(1),
                                        _customerRepo.Count() + 1);
     _view.VehicleBrands = _brandRepo.GetAll();
     _view.Provinces     = _provinceRepo.GetAll();
 }
Exemplo n.º 4
0
        public void SetForm(Add form)
        {
            _form = form;

            _form.VehicleBrands = _brandRepo.GetAll();
        }
Exemplo n.º 5
0
        public void SetForm(View form)
        {
            _form = form;

            _form.Brands = _brandRepo.GetAll();
        }