예제 #1
0
        public void ReadPoints_ZeroOrLessNumberOfPoints_ThrowsArgumentException(double interval, int pointsCount, double startPoint)
        {
            // arrange
            Exception exception = null;

            service = new IntervalReaderService();

            // act
            try
            {
                service.ReadPoints(new IntervalReaderSettings
                {
                    Interval    = interval,
                    PointsCount = pointsCount,
                    StartPoint  = startPoint
                });
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            // assert
            Assert.NotNull(exception);
            Assert.IsInstanceOf <ArgumentException>(exception);
        }
예제 #2
0
        public void ReadPoints_PositiveInterval(double interval, int pointsCount, double startPoint)
        {
            // arrange
            service = new IntervalReaderService();

            // act
            var result = service.ReadPoints(new IntervalReaderSettings
            {
                Interval    = interval,
                PointsCount = pointsCount,
                StartPoint  = startPoint
            });

            // assert
            Assert.AreEqual(result.Length, pointsCount);
            Assert.AreEqual(result[0], startPoint);
            Assert.AreEqual(result[result.Length - 1], startPoint + ((pointsCount - 1) * interval));
        }
예제 #3
0
        public void ReadPoints_ZeroInterval()
        {
            // arrange
            int    pointsCount = 5;
            double startPoint  = 0;

            service = new IntervalReaderService();

            // act
            var result = service.ReadPoints(new IntervalReaderSettings
            {
                Interval    = 0,
                PointsCount = pointsCount,
                StartPoint  = startPoint
            });

            // assert
            Assert.AreEqual(result.Length, pointsCount);
            foreach (var r in result)
            {
                Assert.AreEqual(r, startPoint);
            }
        }