コード例 #1
0
        public void OrderStatusNoneWhenNoBlocksAdded()
        {
            var cashierInput = new CashierInput(new List <int>()
            {
                0, 0, 0, 0, 0, 0, 0, 0, 0
            });
            var toyBlockFactory = new KataToyBlockFactory.ToyBlockFactory(cashierInput);

            toyBlockFactory.StartOrder();
            Assert.Equal(OrderStatus.None, toyBlockFactory.GetOrderStatus(1));
        }
コード例 #2
0
        public void OrderStatusProcessedWhenBlocksAdded()
        {
            var cashierInput = new CashierInput(new List <int>()
            {
                0, 0, 0, 1, 1, 1, 1, 1, 1
            });
            var toyBlockFactory = new KataToyBlockFactory.ToyBlockFactory(cashierInput);

            toyBlockFactory.StartOrder();
            Assert.Equal(OrderStatus.Processed, toyBlockFactory.GetOrderStatus(1));
        }
コード例 #3
0
        public void Placing_An_Order_Will_Create_New_Order()
        {
            var order = _toyBlockFactory.CreateOrder("James", "123 Smith Street, Fitzroy");

            order.AddBlock(Shape.Circle, Color.Blue);
            order.AddBlock(Shape.Triangle, Color.Yellow);
            order.AddBlock(Shape.Square, Color.Red);

            Assert.Equal("James", order.Name);
            Assert.Equal("123 Smith Street, Fitzroy", order.Address);
            Assert.Equal(DateTime.Today.AddDays(7), order.DueDate);
            Assert.Equal(1, order.OrderNumber);
            Assert.Equal(1, order.CountShape(Shape.Circle));
            Assert.Equal(1, order.CountColor(Color.Red));

            Assert.Equal(OrderStatus.New, _toyBlockFactory.GetOrderStatus(1));
            Assert.Equal("James", _toyBlockFactory.GetOrder(1).Name);
        }