Пример #1
0
        public async Task DeleteHistoryTest()
        {
            string expression = "2+2*2";
            string expected   = "History is empty";

            var helpfulRequest = await calculatorController.Get(expression, historyService, calculatorService);

            var notEmptyHistory = await historyController.Delete(historyService);

            var fullHistoryEmptyRequest = await historyController.Get(historyService);

            var okResult_EmptyHistory = await historyController.Delete(historyService);


            Assert.IsInstanceOf <OkObjectResult>(helpfulRequest.Result);
            Assert.IsInstanceOf <OkObjectResult>(notEmptyHistory.Result);
            Assert.IsInstanceOf <OkObjectResult>(fullHistoryEmptyRequest.Result);
            Assert.IsInstanceOf <OkObjectResult>(okResult_EmptyHistory.Result);
            Assert.AreEqual(expected, ((OkObjectResult)fullHistoryEmptyRequest.Result).Value);
        }
Пример #2
0
        public void Delete()
        {
            // 排列
            HistoryController controller = new HistoryController();

            MainHistory value = new MainHistory();
            // 作用
            HttpResponseMessage result = controller.Delete(value);

            // 判斷提示
            Assert.AreEqual(15, result);
        }