Exemplo n.º 1
0
        public void GetDetail_MissingTask()
        {
            var reasoningTaskService = new Mock <IReasoningTaskService>();

            var controller = new ReasoningTaskController(reasoningTaskService.Object);

            var result = controller.GetDetail("testId").Result;

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(NotFoundResult));
        }
Exemplo n.º 2
0
        public void GetDetail_ExistingTask()
        {
            var resource = new DetailedReasoningTaskResource();

            var reasoningTaskService = new Mock <IReasoningTaskService>();

            reasoningTaskService.Setup(x => x.GetTaskDetailAsync(It.IsAny <string>()))
            .Returns(Task.FromResult(resource));

            var controller = new ReasoningTaskController(reasoningTaskService.Object);

            var result = controller.GetDetail("testId").Result as OkObjectResult;

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(OkObjectResult));
            Assert.IsNotNull(result.Value);
            Assert.IsInstanceOfType(result.Value, typeof(DetailedReasoningTaskResource));
        }