예제 #1
0
        public void Test__AggregateSomeComplexCustomAccumulator()
        {
            // Arrange
            _aggregator = new ExpressionAggregator <Person>(Expression.Or);
            _fixture.Customize <Person>(x => x.With(p => p.Age, 20)
                                        .With(p => p.DateOfBirth, DateTime.Now)
                                        .With(p => p.NullableAge, null)
                                        );

            _list.Add(x => x.Age == 20);
            _list.Add(x => x.Parents.Age % 2 == 0);
            _list.Add(x => x.DateOfBirth > DateTime.MinValue);
            _list.Add(x => x.NullableAge == null);

            // Act
            var people = _fixture.CreateMany <Person>(SampleSize).ToList();
            var func   = _aggregator.AggregateAndCompile(_list);

            // Assert
            Assert.Equal(people.Count(), people.Where(func).Count());
        }
예제 #2
0
 public ExpressionAggregatorTests()
 {
     _aggregator = new ExpressionAggregator <Person>();
     _list       = new List <Expression <Func <Person, bool> > >();
     _fixture    = new Fixture();
 }