コード例 #1
0
        public void TriangleFactory_ShouldValidateTriangleExistence(double sideOne, double sideTwo, double sideThree)
        {
            // Arrange
            var parameters = new double[] { sideOne, sideTwo, sideThree };
            var factory    = new TriangleFactory();

            // Act
            var result = factory.TryParseFigureParameters(parameters, out _);

            // Assert
            Assert.False(result);
        }
コード例 #2
0
        public void TriangleFactory_ShouldValidateTriangleSideValues(double sideOne, double sideTwo, double sideThree)
        {
            // Arrange
            var parameters = new double[] { sideOne, sideTwo, sideThree };
            var factory    = new TriangleFactory();

            // Act
            var result = factory.TryParseFigureParameters(parameters, out var message);

            // Assert
            Assert.False(result);
            Assert.Equal("Triangle sides cannot be less or equal zero", message);
        }
コード例 #3
0
        public void TriangleFactory_ShouldValidateParametersLength(int parametersLength)
        {
            // Arrange
            var parameters = new double[parametersLength];
            var factory    = new TriangleFactory();

            // Act
            var result = factory.TryParseFigureParameters(parameters, out var message);

            // Assert
            Assert.False(result);
            Assert.Equal("Triangle parameters array must contain 3 values for triangle sides", message);
        }