Esempio n. 1
0
        public void ValidateTriangle_WrongTriangle_Test()
        {
            const double firstSide  = 1.0;
            const double secondSide = 2.0;
            const double thirdSide  = 4.0;

            var actual = TriangleValidator.Validate(firstSide, secondSide, thirdSide);

            Assert.IsFalse(actual);
        }
Esempio n. 2
0
        public void ValidateTriangle_CorrectTriangle_Test()
        {
            const double firstEdge       = 1.0;
            const double secondEdge      = 2.0;
            var          setOfThirdEdges = new List <double> {
                1.0, 2.0, 3.0
            };

            var actual = setOfThirdEdges.All(x => TriangleValidator.Validate(firstEdge, secondEdge, x));

            Assert.IsTrue(actual);
        }
 private static Triangle CreateTriangle(double firstEdge, double secondEdge, double thirdEdge)
 {
     return(TriangleValidator.Validate(firstEdge, secondEdge, thirdEdge) ? new Triangle(firstEdge, secondEdge, thirdEdge) : null);
 }
Esempio n. 4
0
            public void Should_CheckIfSumOfAnyTwoEdgesIsGreaterThanTheRemainingEdge(int one, int two, int three, bool expected)
            {
                bool result = TriangleValidator.Validate(one, two, three);

                Assert.Equal(expected, result);
            }
 public void TriangleWithCorrectSidesValidationTest()
 {
     Assert.IsTrue(_validator.Validate(new Triangle(3F, 4F, 5F)).IsValid);
 }