コード例 #1
0
        public void testnextordernumber(int order, int expected)
        {
            InMemoryOrderRepository test = new InMemoryOrderRepository();
            var result = test.GetNextOrderNumber();

            Assert.AreEqual(result, expected);
        }
コード例 #2
0
        public void Testdeleteorder(int order, int expected)
        {
            InMemoryOrderRepository test = new InMemoryOrderRepository();
            var result = test.DeleteOrder(order);

            Assert.AreEqual(result.Count, expected);
        }
コード例 #3
0
        public void testgetallorders(string choice, int expected)
        {
            InMemoryOrderRepository test = new InMemoryOrderRepository();
            var result = test.GetAllOrdersByDate(choice);

            Assert.AreEqual(result.Count, expected);
        }
コード例 #4
0
        public void testNextOrderNumeber(int testNumber, int expected)
        {
            InMemoryOrderRepository obj = new InMemoryOrderRepository();

            var result = obj.GetNextOrderNumber();

            Assert.AreEqual(result, expected);
        }
コード例 #5
0
        public void Initialize()
        {
            RestbucksResources.BaseAddress = "http://restbucks.net";
            _repository = new InMemoryOrderRepository();
            var mapper = new PaymentRepresentationMapper();

            _sut = new PaymentResource(new PaymentActivity(_repository, mapper));
        }
コード例 #6
0
        private InMemoryOrderRepository GetOrderRepository()
        {
            var repository = new InMemoryOrderRepository();

            repository.CreateAndAddNewOrder();

            return(repository);;
        }
コード例 #7
0
        private CreateUseCase GetSut()
        {
            var repository = new InMemoryOrderRepository();

            return(new CreateUseCase(
                       repository,
                       _customerRepository.Object,
                       _productRepository.Object));
        }
コード例 #8
0
        public void Initialize()
        {
            RestbucksResources.BaseAddress = "http://restbucks.net";
            _repository = new InMemoryOrderRepository();
            var mapper      = new ReceiptRepresentationMapper();
            var orderMapper = new OrderRepresentationMapper(new ItemRepresentationMapper());

            _sut = new ReceiptResource(new ReadReceiptActivity(_repository, mapper),
                                       new CompleteOrderActivity(_repository, orderMapper));
        }
 public OptmizedCalculationIntegrationTest()
 {
     this.priceRepository             = new InMemoryPriceRepository();
     this.regularBillCalculator       = new RegularCalculationService(priceRepository);
     this.menuBillCalculator          = new MenuCalculationService(priceRepository, new MenuSplitStrategyService());
     this.calculationStrategySelector = new CalculationStrategySelectorService(this.regularBillCalculator, this.menuBillCalculator);
     this.clockMock       = new Mock <IClock>();
     this.paymentService  = new PaymentService(this.calculationStrategySelector, clockMock.Object);
     this.orderRepository = new InMemoryOrderRepository();
     this.orderService    = new OrderService(this.paymentService, this.orderRepository, this.priceRepository, clockMock.Object);
 }
コード例 #10
0
        public void StoresCreatedOrders(InMemoryOrderRepository sut, int orderCount)
        {
            // random number 2..10
            orderCount = orderCount % 9 + 2;

            var createdOrders = new List <Order>();

            for (var i = 0; i < orderCount; i++)
            {
                createdOrders.Add(sut.Create());
            }

            for (var i = 0; i < orderCount; i++)
            {
                var createdOrder = createdOrders[i];
                var order        = sut.GetById(createdOrder.Id);

                Assert.Equal(createdOrder, order);
                Assert.Equal(i + 1, order.Id);
            }
        }
コード例 #11
0
 public OrdersController(InMemoryOrderRepository orderRepository, InMemoryPostamatRepository postamatRepository)
 {
     _orderRepository    = orderRepository;
     _postamatRepository = postamatRepository;
 }