public async Task Test_HomeController_Actions_RedirectToIndex() { var matrixService = Mock.Of <IMatrixService>(); var controller = new HomeController(matrixService); var redirectResult = (await controller.Actions(null)) as RedirectToRouteResult; var routes = redirectResult.RouteValues; Assert.AreEqual("Home", routes["controller"]); Assert.AreEqual("Index", routes["action"]); }
public async Task Test_HomeController_Actions_RotateMatrixСlockwise() { var matrix = new int[1][]; var matrixServiceMock = new Mock <IMatrixService>(); matrixServiceMock.Setup(x => x.ReadMatrixAsync()).ReturnsAsync(matrix); var controller = new HomeController(matrixServiceMock.Object); await controller.Actions("RotateСlockwise"); matrixServiceMock.Verify(x => x.ReadMatrixAsync(), Times.Once); matrixServiceMock.Verify(x => x.RotateMatrixСlockwise(matrix), Times.Once); matrixServiceMock.Verify(x => x.WriteMatrixAsync(matrix), Times.Once); }