Exemplo n.º 1
0
        public void ResetRecords()
        {
            PhoneOrderService           phoneOrderService        = new PhoneOrderService();
            Mock <PhoneOrderRepository> mockPhoneOrderRepository = mockFactory.CreateMock <PhoneOrderRepository>();

            mockPhoneOrderRepository.Expects.One.Method(x => x.Reset());
            phoneOrderService.SetPrivateField("phoneOrderRepository", mockPhoneOrderRepository.MockObject);

            String response = phoneOrderService.ResetRecords();

            Assert.AreEqual("{\"result\":\"Done\",\"count\":0,\"orders\":null}", response);
        }
Exemplo n.º 2
0
        public PhoneOrderMethods() : base("/PhoneOrder")
        {
            Post["/createDefault", true] = async(_, token) => {
                await Task.Delay(50);

                logger.Info("Create default Order");
                return(phoneOrderService.CreateDefaultOrder());
            };

            Post["/count", true] = async(_, token) => {
                await Task.Delay(50);

                logger.Info("Get Count");
                return(phoneOrderService.GetRecordCount());
            };

            Post["/listAll", true] = async(_, token) => {
                await Task.Delay(50);

                logger.Info("List All");
                return(phoneOrderService.GetAllRecords());
            };

            Post["/reset", true] = async(_, token) => {
                await Task.Delay(50);

                logger.Info("reset");
                return(phoneOrderService.ResetRecords());
            };

            Post["/addOrder", true] = async(_, token) => {
                await Task.Delay(50);

                logger.Info("add order");
                return(phoneOrderService.CreatePhoneOrder(this.Request.Body));
            };

            Post["/updateStatus", true] = async(_, token) => {
                await Task.Delay(50);

                logger.Info("Update Status");
                return(phoneOrderService.UpdateOrderStatus(this.Request.Body));
            };
        }