예제 #1
0
        public async Task GetRotateMatrix()
        {
            var matrixDto = new MatrixDTO
            {
                MatrixType = new int[, ]
                {
                    { 10, 15, 20 },
                    { 30, 50, 70 },
                    { 40, 65, 90 }
                }
            };

            Assert.AreEqual(matrixDto.MatrixType[1, 1], 50);
            Assert.AreEqual(matrixDto.MatrixType[0, 0], 10);
            var result = await _matrixService.Rotate(matrixDto);

            Assert.IsTrue(result.MatrixType.Length > 0);
            Assert.AreEqual(matrixDto.MatrixType[1, 1], 50);
            Assert.AreNotEqual(matrixDto.MatrixType[0, 0], 10);
            Assert.AreEqual(matrixDto.MatrixType[0, 0], 40);
            Assert.AreEqual(matrixDto.MatrixType[2, 1], 70);
        }
예제 #2
0
 public async Task <JsonResult> GetRotatedMatrix(MatrixDTO matrix)
 {
     return(Json(new { matrix = await _actionsWithMatrix.Rotate(MatrixDTO.ConversionArray(matrix.ToArray)) }));
 }