Example #1
0
        public async Task GetSuggest_ReturnOk()
        {
            var service = Create.SuggestService().Get();

            var controller = new SuggestController(service);

            var result = await controller.Suggest("input", CancellationToken.None);

            result.Should().BeOfType <OkObjectResult>();
        }
Example #2
0
        public async Task GetSuggest_ReturnConflict()
        {
            var serviceResult = new Result <SuggestServiceResult, IReadOnlyCollection <string> >(SuggestServiceResult.Error);
            var service       = Create.SuggestService().SetResult(serviceResult).Get();

            var controller = new SuggestController(service);

            var result = await controller.Suggest("input", CancellationToken.None);

            result.Should().BeOfType <ConflictObjectResult>();
        }
Example #3
0
        public async Task GetSuggest_ReturnData()
        {
            var data          = new[] { "a", "b", "c" };
            var serviceResult = new Result <SuggestServiceResult, IReadOnlyCollection <string> >(SuggestServiceResult.Ok, data);
            var service       = Create.SuggestService().SetResult(serviceResult).Get();


            var controller = new SuggestController(service);

            var result = await controller.Suggest("input", CancellationToken.None);

            var okResult = result as OkObjectResult;

            okResult.Value.Should().BeEquivalentTo(data);
        }