Example #1
0
        public async Task CanGetAll()
        {
            Data.Add(_history);
            var result = await _controller.Get();

            Assert.Single(result);
            Assert.Equal(result.First(), _history);
        }
Example #2
0
        public void GetAllHistories()
        {
            TestHelper.InitDatabase();
            GetReady();
            var actRes   = controller.Get();
            var response = actRes.ExecuteAsync(CancellationToken.None).Result;

            Assert.IsNotNull(response.Content);
        }
Example #3
0
        public void GetById()
        {
            // 排列
            HistoryController controller = new HistoryController();

            // 作用
            HttpResponseMessage result = controller.Get("aa");

            // 判斷提示
            Assert.AreEqual("value", result);
        }
Example #4
0
        public void Get()
        {
            // 排列
            HistoryController controller = new HistoryController();

            // 作用
            HttpResponseMessage result = controller.Get();

            MainHistory value = new MainHistory();

            // 判斷提示
            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.TryGetContentValue <MainHistory>(out value));
        }
Example #5
0
        public async Task GetEmptyHistoryTest()
        {
            string expected = "History is empty";

            var okResult = await historyController.Get(historyService);

            Assert.IsInstanceOf <OkObjectResult>(okResult.Result);
            Assert.AreEqual(expected, ((OkObjectResult)okResult.Result).Value);
        }