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