public void GetIndexViewModel() { var parentCompany = _companyRepository.Create("ParentCompany", null); var childCompany = _companyRepository.Create("ChildCompany", parentCompany); _stockRepository.Create(parentCompany, _testBussinessCategory, "1234"); _stockRepository.Create(childCompany, _testBussinessCategory, "1235"); var resultViewModel = _workerService.GetIndexViewModel(); var resultCompany = resultViewModel.Companies.ElementAt(1); resultCompany.CompanyName.Is("ChildCompany"); resultCompany.ParentCompanyId.Is(parentCompany.CompanyId); }
public void ProductSizeQuantityRepositoryTests_Create() { StockRepository repository = new StockRepository(); var model = new Stock() { Product_ID = 1, Quantity = 20, Size = "S" }; repository.Create(model); var result = repository.GetByPK(1, "S", "紅"); Assert.IsTrue(result != null); }
public void Create() { var companyRepository = new CompanyRepository(); var company = companyRepository.Create("test", null); company = new CompanyRepository().Read(company.CompanyId); var bussinessRepository = new BussinessCategoryRepository(); var category = bussinessRepository.Create("aaa", "bbb"); var stockRepository = new StockRepository(); var stock = stockRepository.Create(company, category, "123"); var stock2 = new StockRepository(); var result = stock2.Read(stock.StockId); result.Company.CompanyId.Is(company.CompanyId); result.BussinessCategory.BussinessCategoryId.Is(category.BussinessCategoryId); result.StockCode.Is("123"); company = new CompanyRepository().Read(company.CompanyId); company.Stock.IsNotNull(); }