Exemplo n.º 1
0
        public void Reduce_WhenGivenSequenceWithPossibilityOfReduction_ReturnsReducedSequence()
        {
            // Arrange
            var points = new List <Measurement>
            {
                new Measurement {
                    MeasurementTime = new DateTime(2015, 10, 4, 15, 00, 00), AmountSold = 1000, AmountSeasonTicket = 1000
                },
                new Measurement {
                    MeasurementTime = new DateTime(2015, 10, 4, 15, 10, 00), AmountSold = 1000, AmountSeasonTicket = 1000
                },
                new Measurement {
                    MeasurementTime = new DateTime(2015, 10, 4, 15, 20, 00), AmountSold = 1000, AmountSeasonTicket = 1000
                }
            };
            var sut = new PointReducer();

            // Act
            var res = sut.Reduce(points).ToList();

            // Assert
            res.Count.Should().Be(2, "the three have the same value");
            res[0].Should().BeSameAs(points[0]);
            res[1].Should().BeSameAs(points[2]);
        }
Exemplo n.º 2
0
        public void Reduce_WhenGivenEmptySequence_ReturnsEmptySequence()
        {
            // Arrange
            var sut = new PointReducer();

            // Act
            var res = sut.Reduce(Enumerable.Empty <Measurement>()).ToList();

            // Assert
            res.Count.Should().Be(0, "the source list was empty");
        }
Exemplo n.º 3
0
        public void Reduce_WhenGivenNullValue_ReturnsEmptySequence()
        {
            // Arrange
            var sut = new PointReducer();

            // Act
            var res = sut.Reduce(null).ToList();

            // Assert
            res.Should().NotBeNull("we should get an empty sequence");
            res.Should().BeEmpty("there should be nothing here");
        }