コード例 #1
0
        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"]);
        }
コード例 #2
0
        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);
        }