コード例 #1
0
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            // assert we have our defaults setup
            var dtos = PreTestDataWorker.Database.Query<WarehouseDto>("SELECT * FROM merchWarehouse");
            var catalogs = PreTestDataWorker.Database.Query<WarehouseCatalogDto>("SELECT * FROM merchWarehouseCatalog");

            if (!dtos.Any() || !catalogs.Any())
            {
                Assert.Ignore("Warehouse defaults are not installed.");
            }

            // TODO : This is only going to be the case for the initial Merchello release
            Catalog = PreTestDataWorker.WarehouseService.GetDefaultWarehouse().WarehouseCatalogs.FirstOrDefault();

            if (Catalog == null)
            {
                Assert.Ignore("Warehouse Catalog is null");
            }

            GatewayProviderService = PreTestDataWorker.GatewayProviderService;
            StoreSettingService = PreTestDataWorker.StoreSettingService;
            ShipCountryService = PreTestDataWorker.ShipCountryService;

            PreTestDataWorker.DeleteAllShipCountries();
            const string countryCode = "US";

            var us = StoreSettingService.GetCountryByCode(countryCode);
            var shipCountry = new ShipCountry(Catalog.Key, us);
            ShipCountryService.Save(shipCountry);

            var dk = StoreSettingService.GetCountryByCode("DK");
            ShipCountryService.Save(new ShipCountry(Catalog.Key, dk));
        }
コード例 #2
0
        public void Init()
        {
            _gatewayProviderService = PreTestDataWorker.GatewayProviderService;
            _storeSettingService = PreTestDataWorker.StoreSettingService;
            _shipCountryService = PreTestDataWorker.ShipCountryService;

            _merchelloContext = new MerchelloContext(new ServiceContext(new PetaPocoUnitOfWorkProvider()),
                new CacheHelper(new NullCacheProvider(),
                    new NullCacheProvider(),
                    new NullCacheProvider()));

            _catalog = PreTestDataWorker.WarehouseService.GetDefaultWarehouse().WarehouseCatalogs.FirstOrDefault();

            PreTestDataWorker.DeleteAllShipCountries();
            var country = _storeSettingService.GetCountryByCode("US");
            var shipCountry = new ShipCountry(_catalog.Key, country);
            _shipCountryService.Save(shipCountry);

            var shippingProvider =
               (FixedRateShippingGatewayProvider) _merchelloContext.Gateways.Shipping.CreateInstance(Core.Constants.ProviderKeys.Shipping.FixedRateShippingProviderKey);
            Assert.NotNull(shippingProvider);

            var resource = shippingProvider.ListResourcesOffered().FirstOrDefault();
            var gatewayShipMethod = shippingProvider.CreateShippingGatewayMethod(resource, shipCountry, "Ground");
            shippingProvider.SaveShippingGatewayMethod(gatewayShipMethod);
        }
コード例 #3
0
        public void Init()
        {
            _gatewayProviderService = PreTestDataWorker.GatewayProviderService;
            _storeSettingService    = PreTestDataWorker.StoreSettingService;
            _shipCountryService     = PreTestDataWorker.ShipCountryService;


            _catalog = PreTestDataWorker.WarehouseService.GetDefaultWarehouse().WarehouseCatalogs.FirstOrDefault();

            PreTestDataWorker.DeleteAllShipCountries();
            var country     = _storeSettingService.GetCountryByCode("US");
            var shipCountry = new ShipCountry(_catalog.Key, country);

            _shipCountryService.Save(shipCountry);


            var shippingProvider =
                (FixedRateShippingGatewayProvider)MerchelloContext.Gateways.Shipping.CreateInstance(Core.Constants.ProviderKeys.Shipping.FixedRateShippingProviderKey);

            Assert.NotNull(shippingProvider);

            var resource          = shippingProvider.ListResourcesOffered().FirstOrDefault();
            var gatewayShipMethod = shippingProvider.CreateShippingGatewayMethod(resource, shipCountry, "Ground");

            shippingProvider.SaveShippingGatewayMethod(gatewayShipMethod);
        }
コード例 #4
0
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            // assert we have our defaults setup
            var dtos     = PreTestDataWorker.Database.Query <WarehouseDto>("SELECT * FROM merchWarehouse");
            var catalogs = PreTestDataWorker.Database.Query <WarehouseCatalogDto>("SELECT * FROM merchWarehouseCatalog");

            if (!dtos.Any() || !catalogs.Any())
            {
                Assert.Ignore("Warehouse defaults are not installed.");
            }

            // TODO : This is only going to be the case for the initial Merchello release
            Catalog = PreTestDataWorker.WarehouseService.GetDefaultWarehouse().WarehouseCatalogs.FirstOrDefault();

            if (Catalog == null)
            {
                Assert.Ignore("Warehouse Catalog is null");
            }

            GatewayProviderService = PreTestDataWorker.GatewayProviderService;
            StoreSettingService    = PreTestDataWorker.StoreSettingService;
            ShipCountryService     = PreTestDataWorker.ShipCountryService;


            PreTestDataWorker.DeleteAllShipCountries();
            const string countryCode = "US";

            var us          = StoreSettingService.GetCountryByCode(countryCode);
            var shipCountry = new ShipCountry(Catalog.Key, us);

            ShipCountryService.Save(shipCountry);

            var dk = StoreSettingService.GetCountryByCode("DK");

            ShipCountryService.Save(new ShipCountry(Catalog.Key, dk));
        }
コード例 #5
0
        public void Can_Create_And_Save_A_ShipCountry()
        {
            //// Arrange
            const string countryCode = "US";
            var          country     = _storeSettingService.GetCountryByCode(countryCode);

            //// Act
            var shipCountry = new ShipCountry(_catalog.Key, country);

            Assert.IsFalse(shipCountry.HasIdentity);

            _shipCountryService.Save(shipCountry);

            //// Assert
            Assert.IsTrue(shipCountry.HasIdentity);
        }