Exemplo n.º 1
0
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            PreTestDataWorker.DeleteAllCustomers();

            var bootManager = new WebBootManager();

            bootManager.Initialize();

            _address = new Address()
            {
                Name        = "Test",
                Address1    = "111 Somewhere Outwhere",
                Locality    = "Out There",
                PostalCode  = "98225",
                Region      = "WA",
                CountryCode = "US",
                Email       = "*****@*****.**"
            };

            InvoiceService.Saved += InvoiceServiceSaved;

            OrderService.Saved += OrderServiceSaved;

            //var invoiceProvider = (InvoiceIndexer)ExamineManager.Instance.IndexProviderCollection["MerchelloInvoiceIndexer"];
            //invoiceProvider.RebuildIndex();
        }
        public void WrapViewEngines_CollectionIsNull_DoesNotThrow()
        {
            IList <IViewEngine> engines = null;

            Assert.DoesNotThrow(() => WebBootManager.WrapViewEngines(engines));
            Assert.That(engines, Is.Null);
        }
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            PreTestDataWorker.DeleteAllPaymentMethods();
            PreTestDataWorker.DeleteAllShipCountries();

            // Merchello CoreBootStrap
            var bootManager = new WebBootManager();

            bootManager.Initialize();

            _merchelloContext = Core.MerchelloContext.Current;

            var defaultCatalog = PreTestDataWorker.WarehouseService.GetDefaultWarehouse().WarehouseCatalogs.FirstOrDefault();

            if (defaultCatalog == null)
            {
                Assert.Ignore("Default WarehouseCatalog is null");
            }

            var us        = _merchelloContext.Services.StoreSettingService.GetCountryByCode("US");
            var usCountry = new ShipCountry(defaultCatalog.Key, us);

            ((ServiceContext)_merchelloContext.Services).ShipCountryService.Save(usCountry);

            #region Settings -> Taxation

            var taxProvider = _merchelloContext.Gateways.Taxation.CreateInstance(Constants.ProviderKeys.Taxation.FixedRateTaxationProviderKey);

            taxProvider.DeleteAllTaxMethods();

            var gwTaxMethod = taxProvider.CreateTaxMethod("US", 0);

            gwTaxMethod.TaxMethod.Provinces["WA"].PercentAdjustment = 8.7M;

            taxProvider.SaveTaxMethod(gwTaxMethod);


            #endregion

            _address = new Address()
            {
                Address1    = "114 W. Magnolia St.",
                Address2    = "Suite 504",
                Locality    = "Bellingham",
                Region      = "WA",
                CountryCode = "US"
            };

            var gateway  = _merchelloContext.Gateways.Payment.GetAllActivatedProviders().FirstOrDefault();
            var provider = _merchelloContext.Gateways.Payment.CreateInstance(gateway.Key);
            var resource = provider.ListResourcesOffered().FirstOrDefault(x => x.ServiceCode == "Cash");
            var method   = provider.CreatePaymentMethod(resource, "Cash", "Cash Payments");
            provider.SavePaymentMethod(method);

            _paymentMethodKey = method.PaymentMethod.Key;
        }
        public void WrapViewEngines_HasProfiledEngine_AddsSameInstance()
        {
            var profiledEngine          = new ProfilingViewEngine(new PluginViewEngine());
            IList <IViewEngine> engines = new List <IViewEngine>
            {
                profiledEngine
            };

            WebBootManager.WrapViewEngines(engines);

            Assert.That(engines[0], Is.SameAs(profiledEngine));
        }
Exemplo n.º 5
0
        public override void Initialize()
        {
            base.Initialize();

            SettingsForTests.UmbracoPath = "~/umbraco";

            var webBoot = new WebBootManager(new UmbracoApplication(), true);

            //webBoot.Initialize();
            //webBoot.Startup(null); -> don't call startup, we don't want any other application event handlers to bind for this test.
            //webBoot.Complete(null);
            webBoot.CreateRoutes();
        }
        public void WrapViewEngines_HasEngines_KeepsSortOrder()
        {
            IList <IViewEngine> engines = new List <IViewEngine>
            {
                new RenderViewEngine(),
                new PluginViewEngine()
            };

            WebBootManager.WrapViewEngines(engines);

            Assert.That(engines.Count, Is.EqualTo(2));
            Assert.That(((ProfilingViewEngine)engines[0]).Inner, Is.InstanceOf <RenderViewEngine>());
            Assert.That(((ProfilingViewEngine)engines[1]).Inner, Is.InstanceOf <PluginViewEngine>());
        }
        public void WrapViewEngines_HasEngines_WrapsAll()
        {
            IList <IViewEngine> engines = new List <IViewEngine>
            {
                new RenderViewEngine(),
                new PluginViewEngine()
            };

            WebBootManager.WrapViewEngines(engines);

            Assert.That(engines.Count, Is.EqualTo(2));
            Assert.That(engines[0], Is.InstanceOf <ProfilingViewEngine>());
            Assert.That(engines[1], Is.InstanceOf <ProfilingViewEngine>());
        }
Exemplo n.º 8
0
        public override void Initialize()
        {
            base.Initialize();
            System.Configuration.ConfigurationManager.AppSettings.Set("umbracoPath", "~/umbraco");

            SurfaceControllerResolver.Current = new SurfaceControllerResolver(
                PluginManager.Current.ResolveSurfaceControllers());

            var webBoot = new WebBootManager(new UmbracoApplication(), true);

            //webBoot.Initialize();
            //webBoot.Startup(null); -> don't call startup, we don't want any other application event handlers to bind for this test.
            //webBoot.Complete(null);
            webBoot.CreateRoutes();
        }
Exemplo n.º 9
0
        public virtual void FixtureSetup()
        {
            // Sets Umbraco SqlSytax and ensure database is setup
            var dbPreTestDataWorker = new DbPreTestDataWorker();

            // Merchello CoreBootStrap
            var bootManager = new WebBootManager(dbPreTestDataWorker.TestLogger, dbPreTestDataWorker.SqlSyntaxProvider);

            bootManager.Initialize();


            if (MerchelloContext.Current == null)
            {
                Assert.Ignore("MerchelloContext.Current is null");
            }
        }
Exemplo n.º 10
0
        public override void FixtureSetup()
        {
            base.FixtureSetup();

            var bootManager = new WebBootManager();

            bootManager.Initialize();

            _customerIndexer = (CustomerIndexer)ExamineManager.Instance.IndexProviderCollection["MerchelloCustomerIndexer"];
            _searcher        = ExamineManager.Instance.SearchProviderCollection["MerchelloCustomerSearcher"];

            _customerService = PreTestDataWorker.CustomerService;

            CustomerService.Created += CustomerServiceCreated;
            CustomerService.Saved   += CustomerServiceSaved;
            CustomerService.Deleted += CustomerServiceDeleted;
        }
Exemplo n.º 11
0
        public override void Initialize()
        {
            //this ensures its reset
            PluginManager.Current = new PluginManager();

            SurfaceControllerResolver.Current = new SurfaceControllerResolver(
                PluginManager.Current.ResolveSurfaceControllers());

            base.Initialize();

            SettingsForTests.UmbracoPath = "~/umbraco";

            var webBoot = new WebBootManager(new UmbracoApplication(), true);

            //webBoot.Initialize();
            //webBoot.Startup(null); -> don't call startup, we don't want any other application event handlers to bind for this test.
            //webBoot.Complete(null);
            webBoot.CreateRoutes();
        }