Exemplo n.º 1
0
        public static ITestEnvironment Create(Action <TestEnvironmentCreateContext> context)
        {
            var mocks = new TestMocks();

            var createContextObj = new TestEnvironmentCreateContext(mocks);

            context(createContextObj);

            mocks.DiscountsService.GetBundleStructure()
            .Returns(createContextObj.DiscountStructure.GetDiscountInfos());

            var environmentObject = new TestEnvironmentObject(createContextObj, mocks);

            return(environmentObject);
        }
        public TestEnvironmentObject(TestEnvironmentCreateContext createContext, ITestMocks mocks)
        {
            _productsTable = createContext.Products;

            ElementInfos = new TestDbObjectList <string, ElementInfo>(
                k =>
            {
                var p = Products.Get(k);
                return(new ElementInfo(p.Info, ItemId.New(), 1));
            });

            //Prices = new Dictionary<string, ElementPrice>();

            SalesOrderEntities = createContext.Documents.SalesOrderEntities;

            DocumentFactories = new DocumentFactoryProvider(this);

            Products = new ProductsProvider(createContext.Products);

            Mocks = mocks;
        }