コード例 #1
0
        public void ExecuteEmptyMatrixTest()
        {
            var matrix = new Matrix(2, 2);
            var det    = new Determinant(matrix);

            Assert.Throws <ArgumentException>(() => det.Execute());
        }
コード例 #2
0
        public void ExecuteVectorTest()
        {
            var vector = new Vector(new[] { new Number(1), new Number(-2), new Number(3) });
            var det    = new Determinant(vector);

            Assert.Throws <ResultIsNotSupportedException>(() => det.Execute());
        }
コード例 #3
0
        public void ExecuteIsNotSquareTest()
        {
            var matrix = new Matrix(new[]
            {
                new Vector(new[] { new Number(1), new Number(-2), new Number(3) }),
                new Vector(new[] { new Number(4), new Number(0), new Number(6) })
            });

            var det = new Determinant(matrix);

            Assert.Throws <ArgumentException>(() => det.Execute());
        }
コード例 #4
0
        public void ExecuteTest()
        {
            var matrix = new Matrix(new[]
            {
                new Vector(new[] { new Number(1), new Number(-2), new Number(3) }),
                new Vector(new[] { new Number(4), new Number(0), new Number(6) }),
                new Vector(new[] { new Number(-7), new Number(8), new Number(9) })
            });

            var det = new Determinant(matrix);

            Assert.Equal(204.0, det.Execute());
        }