public void DeleteTheOrders_ForTheIdsPassedIn()
        {
            var mockOrderRepository = MockRepository.GenerateMock<IOrderRepository>();
            var mockViewOrder = MockRepository.GenerateMock<IViewOrder>();
            mockViewOrder.Stub(x => x.ShouldSaveStudent).Return(false);
            var customerService = new CustomerService(mockOrderRepository, mockViewOrder);
            const int orderId1 = 1;
            const int orderId2 = 2;
            const int orderId3 = 3;

            int[] orderIds = {orderId1, orderId2, orderId3};

            var order1 = new Order {ID = orderId1, DatePurchased = new DateTime(2013, 1, 1), ItemDescription = "Chair1"};
            var order2 = new Order { ID = orderId2, DatePurchased = new DateTime(2013, 1, 1), ItemDescription = "Chair2" };
            var order3 = new Order { ID = orderId3, DatePurchased = new DateTime(2013, 1, 1), ItemDescription = "Chair3" };

            mockOrderRepository.Stub(x => x.FindById(orderId1)).Return(order1);
            mockOrderRepository.Stub(x => x.FindById(orderId2)).Return(order2);
            mockOrderRepository.Stub(x => x.FindById(orderId3)).Return(order3);

            customerService.DeleteTheOrder(orderIds);

            mockOrderRepository.AssertWasCalled(x => x.DeleteOrders(Arg<List<Order>>.List.ContainsAll(new List<Order>{order1,order2,order3})));
            mockOrderRepository.AssertWasCalled(x => x.DeleteOrders(Arg<List<Order>>.List.Equal(new List<Order>{order1,order2,order3})));
            mockOrderRepository.AssertWasCalled(x => x.DeleteOrders(new List<Order>{order1,order2,order3}));
            mockOrderRepository.AssertWasCalled(x => x.DeleteOrders(Arg<List<Order>>.List.Count(Rhino.Mocks.Constraints.Is.Equal(3))));
            mockOrderRepository.AssertWasCalled(x => x.DeleteOrders(Arg<List<Order>>.List.IsIn(order3)));
        }
        public void Should_FindTheOrderByItemName()
        {
            var orderRepository = MockRepository.GenerateMock<IOrderRepository>();
            var viewOrder = MockRepository.GenerateMock<IViewOrder>();
            var customerService = new CustomerService(orderRepository,viewOrder);

            customerService.FindByItemName("Computer");

            orderRepository.AssertWasCalled(x=>x.FindByItemDescripton(Arg<String>.Matches(Rhino.Mocks.Constraints.Text.Contains("Compu"))));
            orderRepository.AssertWasCalled(x=>x.FindByItemDescripton(Arg<String>.Matches(Rhino.Mocks.Constraints.Text.Like("Com.*"))));
        }
        public void RegisterTheOrder__ShouldSaveTheOrder_WhenTheOrderIsValid()
        {
            var mockOrderRepository = MockRepository.GenerateMock<IOrderRepository>();
            var mockViewOrder = MockRepository.GenerateMock<IViewOrder>();
            mockViewOrder.Stub(x => x.ShouldSaveStudent).Return(false);
            var customerService = new CustomerService(mockOrderRepository, mockViewOrder);
            const int studentId = 1;
            customerService.RegisterNewOrder(studentId,"Chair",new DateTime(2014,1,1));

            mockOrderRepository.AssertWasCalled(x=>x.Save(Arg<Order>.Matches(o=> o.ID == studentId)));
        }