예제 #1
0
        public void ReadPoints_InvalidCases_ThrowsArgumentException(double[] dependentPoints, string diffPoints)
        {
            // arrange
            Exception exception = null;

            service = new RelativePointsReaderService();

            // act
            try
            {
                service.ReadPoints(new RelativePointsReaderSettings
                {
                    DependentPoints = dependentPoints,
                    DiffValues      = diffPoints
                });
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            // assert
            Assert.NotNull(exception);
            Assert.IsInstanceOf <ArgumentException>(exception);
        }
예제 #2
0
        public void ReadPoints_SomeDependentNegativePointsAndDiffValues_ReturnSameLengthOfDependentPointsWithNewValues()
        {
            // arrange
            var dependentPoints = new double[] { 1, 2, 3, 4 };

            service = new RelativePointsReaderService();

            // act
            var result = service.ReadPoints(new RelativePointsReaderSettings
            {
                DependentPoints = dependentPoints,
                DiffValues      = "-1, -2, -3, -4"
            });

            // assert
            Assert.AreEqual(dependentPoints.Length, result.Length);
            for (var i = 0; i < dependentPoints.Length; i++)
            {
                Assert.AreEqual(result[i], 0);
            }
        }