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

            var controller = new ReasoningTaskController(reasoningTaskService.Object);

            var result = controller.SetVariables("testId", new VariablesResource()).Result;

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

            var reasoningTaskService = new Mock <IReasoningTaskService>();

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

            var controller = new ReasoningTaskController(reasoningTaskService.Object);

            var result = controller.SetVariables("testId", new VariablesResource()).Result as OkObjectResult;

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