Esempio n. 1
0
        public void InvalidTriangleWithZeroSide()
        {
            Triangle triangle = new Triangle(0, 4, 5);
            double   expected = -1;

            Assert.IsFalse(triangle.IsValid());
            Assert.AreEqual(expected, triangle.Area(), 0.0001, "Что-то пошло не так");
        }
Esempio n. 2
0
        public void InvalidTriangleWithAllNonZeroSides()
        {
            Triangle triangle = new Triangle(2, 2, 5);
            bool     expected = false;

            Assert.IsFalse(triangle.IsValid());
            Assert.AreEqual(expected, triangle.IsRightTriangle(), "Что-то пошло не так");
        }
Esempio n. 3
0
 public void Triangle1Test()
 {
     Triangle.IsValid(5, 10, 25).Should().BeFalse();
     Triangle.IsValid(25, 10, 5).Should().BeFalse();
     Triangle.IsValid(5, 10, 10).Should().BeTrue();
     Triangle.IsValid(5, 10, 5).Should().BeFalse();
     Triangle.IsValid(5, 10, 6).Should().BeTrue();
 }
Esempio n. 4
0
        public void ValidRightTriangle()
        {
            Triangle triangle = new Triangle(3, 4, 5);
            double   expected = 6;

            Assert.IsTrue(triangle.IsValid());
            Assert.AreEqual(expected, triangle.Area(), 0.0001, "Что-то пошло не так");
            Assert.IsTrue(triangle.IsRightTriangle());
        }