コード例 #1
0
        public void TestTriangle()
        {
            var expected = 6.78;
            var tr       = new Triangle(4, 4, 7);

            Assert.AreEqual(tr.IsRightAngled(), false);
            Assert.AreEqual(expected, Math.Round(tr.GetSquare(), 2));

            expected = 6;
            tr       = new Triangle(3, 4, 5);
            Assert.AreEqual(tr.IsRightAngled(), true);
            Assert.AreEqual(expected, tr.GetSquare());
        }
コード例 #2
0
ファイル: TriangleTest.cs プロジェクト: karburator/Geometry
        public void GetSquareTest()
        {
            // Data.
            double a = 3d, b = 4d, c = 5d;
            double result   = 6d;
            var    triangle = new Triangle(a, b, c);

            // Act.
            var square = triangle?.GetSquare();

            // Assert.
            Assert.NotNull(square);
            Assert.Less(Math.Abs(square.Value - result), Constants.CalculationAccuracy);
        }