コード例 #1
0
        protected override void Before_all_specs()
        {
            SetupDatabase(ShopGunSpecBase.Database.ShopGun, typeof(Base).Assembly);

            IConfiguration configuration = new BasicConfiguration();
            var            container     = configuration.Container;

            _ingredientRepository = new IngredientRepository(GetNewDataContext());
            _semaphoreRepository  = new Repository <Semaphore>(GetNewDataContext());
            _mentorRepository     = new Repository <Mentor>(GetNewDataContext());

            _ingredientAdviceRepository    = new Repository <IngredientAdvice>(GetNewDataContext());
            _ingredientAdviceDomainService = new IngredientAdviceDomainService(_ingredientRepository,
                                                                               _ingredientAdviceRepository,
                                                                               GetNewDataContext());



            _mentor = MentorBuilder.BuildMentor();
            _mentorRepository.Add(_mentor);
            _mentorRepository.Persist();

            _redSemaphore = SemaphoreBuilder.BuildRedSemaphore();
            _semaphoreRepository.Add(_redSemaphore);
            _greenSemaphore = SemaphoreBuilder.BuildGreenSemaphore();
            _semaphoreRepository.Add(_greenSemaphore);
            _semaphoreRepository.Persist();

            _ingredient = IngredientBuilder.BuildIngredient();
            _ingredientRepository.Add(_ingredient);
            _ingredientRepository.Persist();

            base.Before_each_spec();
        }
コード例 #2
0
ファイル: IngredientSpec.cs プロジェクト: consumentor/Server
        protected override void Before_all_specs()
        {
            SetupDatabase(ShopGunSpecBase.Database.ShopGun, typeof(Base).Assembly);

            _ingredientAdviceRepository = new Repository <IngredientAdvice>(GetNewDataContext());

            _ingredientRepository = new IngredientRepository(GetNewDataContext());
            _semaphoreRepository  = new Repository <Semaphore>(GetNewDataContext());
            _mentorRepository     = new Repository <Mentor>(GetNewDataContext());

            _mentor = MentorBuilder.BuildMentor();
            _mentorRepository.Add(_mentor);
            _mentorRepository.Persist();

            _redSemaphore = SemaphoreBuilder.BuildRedSemaphore();
            _semaphoreRepository.Add(_redSemaphore);
            _greenSemaphore = SemaphoreBuilder.BuildGreenSemaphore();
            _semaphoreRepository.Add(_greenSemaphore);
            _semaphoreRepository.Persist();

            base.Before_each_spec();
        }
コード例 #3
0
        protected override void Before_all_specs()
        {
            SetupDatabase(ShopGunSpecBase.Database.ShopGun, typeof(Base).Assembly);

            _productRepository         = new ProductRepository(GetNewDataContext());
            _productApplicationService = new ProductApplicationService(null, null, null, null, null);

            _brand = BrandBuilder.BuildBrand();
            using (var brandRepository = new Repository <Brand>(GetNewDataContext()))
            {
                brandRepository.Add(_brand);
                brandRepository.Persist();
            }

            _country = CountryBuilder.BuildCountry();
            using (var countryRepository = new Repository <Country>(GetNewDataContext()))
            {
                countryRepository.Add(_country);
                countryRepository.Persist();
            }

            _mentor            = MentorBuilder.BuildMentor();
            _certificationMark = CertificationMarkBuilder.BuildCertificationMark(_mentor);
            using (var certificationMarkRepository = new Repository <CertificationMark>(GetNewDataContext()))
            {
                certificationMarkRepository.Add(_certificationMark);
                certificationMarkRepository.Persist();
            }

            _ingredient = IngredientBuilder.BuildIngredient();
            using (var ingredientRepository = new Repository <Ingredient>(GetNewDataContext()))
            {
                ingredientRepository.Add(_ingredient);
                ingredientRepository.Persist();
            }
        }