protected override void Before_each_spec() { _productAdviceRepository = new Repository<ProductAdvice>(GetNewDataContext()); _productAdviceDomainService = new ProductAdviceDomainService(new ProductRepository(GetNewDataContext()), _productAdviceRepository, GetNewDataContext()); _productRepository = new ProductRepository(GetNewDataContext()); _semaphoreRepository = new Repository<Semaphore>(GetNewDataContext()); _mentorRepository = new Repository<Mentor>(GetNewDataContext()); using (var dataContext = GetNewDataContext()) { var advices = dataContext.GetTable<AdviceBase>().Where(x => x.Id != 0); dataContext.GetTable<AdviceBase>().DeleteAllOnSubmit(advices); dataContext.SubmitChanges(); } }
protected override void Before_each_spec() { _productAdviceRepository = new Repository <ProductAdvice>(GetNewDataContext()); _productAdviceDomainService = new ProductAdviceDomainService(new ProductRepository(GetNewDataContext()), _productAdviceRepository, GetNewDataContext()); _productRepository = new ProductRepository(GetNewDataContext()); _semaphoreRepository = new Repository <Semaphore>(GetNewDataContext()); _mentorRepository = new Repository <Mentor>(GetNewDataContext()); using (var dataContext = GetNewDataContext()) { var advices = dataContext.GetTable <AdviceBase>().Where(x => x.Id != 0); dataContext.GetTable <AdviceBase>().DeleteAllOnSubmit(advices); dataContext.SubmitChanges(); } }
protected override void Before_all_specs() { SetupDatabase(ShopGunSpecBase.Database.ShopGun, typeof(Base).Assembly); _productBuilder = new ProductBuilder(); _productAdviceRepository = new Repository<ProductAdvice>(GetNewDataContext()); _productAdviceDomainService = new ProductAdviceDomainService(new ProductRepository(GetNewDataContext()), _productAdviceRepository, GetNewDataContext()); _productRepository = new ProductRepository(GetNewDataContext()); _semaphoreRepository = new Repository<Semaphore>(GetNewDataContext()); _mentorRepository = new Repository<Mentor>(GetNewDataContext()); _mentor = new Mentor { MentorName = "Consumentor" }; _mentorRepository.Add(_mentor); _mentorRepository.Persist(); _redSemaphore = new Semaphore { ColorName = "Red", Value = -1 }; _semaphoreRepository.Add(_redSemaphore); _greenSemaphore = new Semaphore { ColorName = "Green", Value = 1 }; _semaphoreRepository.Add(_greenSemaphore); _semaphoreRepository.Persist(); _product = ProductBuilder.BuildProduct(); _productRepository.Add(_product); _productRepository.Persist(); base.Before_each_spec(); }
protected override void Before_all_specs() { SetupDatabase(ShopGunSpecBase.Database.ShopGun, typeof(Base).Assembly); _productBuilder = new ProductBuilder(); _productAdviceRepository = new Repository <ProductAdvice>(GetNewDataContext()); _productAdviceDomainService = new ProductAdviceDomainService(new ProductRepository(GetNewDataContext()), _productAdviceRepository, GetNewDataContext()); _productRepository = new ProductRepository(GetNewDataContext()); _semaphoreRepository = new Repository <Semaphore>(GetNewDataContext()); _mentorRepository = new Repository <Mentor>(GetNewDataContext()); _mentor = new Mentor { MentorName = "Consumentor" }; _mentorRepository.Add(_mentor); _mentorRepository.Persist(); _redSemaphore = new Semaphore { ColorName = "Red", Value = -1 }; _semaphoreRepository.Add(_redSemaphore); _greenSemaphore = new Semaphore { ColorName = "Green", Value = 1 }; _semaphoreRepository.Add(_greenSemaphore); _semaphoreRepository.Persist(); _product = ProductBuilder.BuildProduct(); _productRepository.Add(_product); _productRepository.Persist(); base.Before_each_spec(); }