示例#1
0
        public async Task QueryApiShouldReturnBadRequestOnError()
        {
            var repo     = new DummyQueryRepo(true);
            var engine   = new QueryEngine(_coreDependencies, repo);
            var response = await engine.GetMailSentimentListAsync();

            Assert.Equal(1, repo.InvocationCount);
            Assert.Equal(HttpStatusCode.BadRequest, response.ErrorCode);
        }
示例#2
0
        public async Task QueryApiShouldReturnDataWhenNoError()
        {
            var repo     = new DummyQueryRepo(false);
            var engine   = new QueryEngine(_coreDependencies, repo);
            var response = await engine.GetMailSentimentListAsync();

            Assert.Equal(1, repo.InvocationCount);
            Assert.False(response.HasError);
            Assert.NotNull(response.ResponseData);
            Assert.NotEmpty(response.ResponseData);
        }