public async Task DisableAgentById_ReturnOk() { var command = new DisableAgentByIdCommand() { AgentId = 1 }; _mockMediator.Setup(mediator => mediator.Send(It.IsAny <DisableAgentByIdCommand>(), It.IsAny <CancellationToken>())) .ReturnsAsync(Unit.Value); var result = await _controller.DisableAgentById(command); _mockMediator.Verify(mediator => mediator.Send(It.Is <DisableAgentByIdCommand>( m => m.AgentId == command.AgentId), It.IsAny <CancellationToken>()), Times.Once); Assert.IsAssignableFrom <IActionResult>(result); }
public void DisableAgentById_ReturnsOk() { var agentId = 1; var result = _controller.DisableAgentById(agentId); _ = Assert.IsAssignableFrom <IActionResult>(result); }
public void DisableAgentByIdCheckRequestCreate() { //Arrange _mock.Setup(a => a.GetById(0)).Returns(new AgentModel()).Verifiable(); //Act var result = _controller.DisableAgentById(0); //Assert _mock.Verify(repository => repository.GetById(0), Times.AtMostOnce()); _logger.Verify(); }
public void DisableAgentById_ReturnsOk() { //Arrange var agentId = 1; //Act var result = controller.DisableAgentById(agentId); // Assert _ = Assert.IsAssignableFrom <IActionResult>(result); }
public void DisableAgentById_ReturnsOk() { //Подготовка данных var agentId = 1; //Действие var result = _controller.DisableAgentById(agentId); //Проверка результата _ = Assert.IsAssignableFrom <IActionResult>(result); }
public void DisableAgentByIdCheckRequestCreate() { //Arrange var mockLogger = new Mock <ILogger <AgentsController> >(); var mockGet = new Mock <IAgentsRepository>(); var mockUpdate = new Mock <IAgentsRepository>(); mockGet.Setup(a => a.GetById(0)).Returns(new AgentModel()).Verifiable(); mockUpdate.Setup(a => a.Update(new AgentModel())).Verifiable(); var controller = new AgentsController(mockGet.Object, mockLogger.Object); //Act var result = controller.DisableAgentById(0); //Assert mockGet.Verify(repository => repository.GetById(0), Times.AtMostOnce()); mockUpdate.Verify(repository => repository.Update(new AgentModel()), Times.AtMostOnce()); mockLogger.Verify(); }
public void DisableAgentById_ReturnOk() { var result = _controller.DisableAgentById(_agentInfo.AgentId); Assert.IsAssignableFrom <IActionResult>(result); }
public void DisableAgentById_ReturnsOk() { var result = controller.DisableAgentById(_registeredAgents[0].AgentId); _ = Assert.IsAssignableFrom <IActionResult>(result); }