示例#1
0
        public void CanOrderOrderedDocuments()
        {
            var path = Path.GetFullPath(@"data\ordered-documents\");

            var command = new LoadDocumentsCommand();

            command.Author             = new Author();
            command.DocumentsPath      = path;
            command.OutputRootPath     = Path.GetFullPath("output");
            command.RenderedExtensions = new[] { "md" };
            command.RootUrl            = "http://www.example.com/";
            command.ApplicationUrl     = "/foo";
            command.ExecuteAsync().Wait();

            var order = new OrderCommand();

            order.Documents = command.Documents;
            order.Execute();

            Assert.Equal(1, order.Books.Count());

            var doc = command.Documents.Skip(3).Take(1).Single();

            var data = order.Books.First().GetAsDynamic(doc);
        }
示例#2
0
        private void Order(Site site)
        {
            using (var capture = Statistics.Current.Start(StatisticTiming.Ordering))
            {
                var order = new OrderCommand();
                order.Documents = site.Documents;
                order.Execute();

                site.Books = order.Books;
            }
        }
示例#3
0
        public void TestTshirt()
        {
            // Given
            IProduct           tshirt     = new Tshirt();
            PurchaseController controller = new PurchaseController();
            ICommand           order      = new OrderCommand(tshirt);

            controller.InsertCommand(order);
            ICommand buy = new BuyCommand(tshirt);

            controller.InsertCommand(buy);

            // When
            var order_t = order.Execute();
            var buy_t   = buy.Execute();

            // Then
            Assert.AreEqual("T-shirt", order_t);
            Assert.AreEqual("19.99", buy_t);
        }
示例#4
0
        public void TestShoes()
        {
            // Given
            IProduct           shoes      = new Shoes();
            PurchaseController controller = new PurchaseController();
            ICommand           order      = new OrderCommand(shoes);

            controller.InsertCommand(order);
            ICommand buy = new BuyCommand(shoes);

            controller.InsertCommand(buy);

            // When
            var order_t = order.Execute();
            var buy_t   = buy.Execute();

            // Then
            Assert.AreEqual("Shoes", order_t);
            Assert.AreEqual("39.99", buy_t);
        }
示例#5
0
        public void CanOrderUnorderedDocuments()
        {
            var path = Path.GetFullPath(@"data\dated-documents\");

            var command = new LoadDocumentsCommand();

            command.Author             = new Author();
            command.DocumentsPath      = path;
            command.OutputRootPath     = Path.GetFullPath("output");
            command.RenderedExtensions = new[] { "md" };
            command.RootUrl            = "http://www.example.com/";
            command.ApplicationUrl     = "/foo";
            command.ExecuteAsync().Wait();

            var order = new OrderCommand();

            order.Documents = command.Documents;
            order.Execute();

            Assert.Equal(0, order.Books.Count());
        }
示例#6
0
 public void ExecuteCommand(OrderCommand command, MenuItem item)
 {
     command.Execute(this.currentItems, item);
 }