public void ShouldBeToThrowArgumentNullExceptionWhenSelectorNull() { var mockPageable = new Mock <IRSqlPageable <Customer> >(); mockPageable.Setup(x => x.PageNumber()).Returns(10); mockPageable.Setup(x => x.PageSize()).Returns(2); mockPageable.Setup(x => x.Sort()).Returns((RSqlSort <Customer>)null); var fake = new Faker <Customer>() .RuleFor(c => c.Name, f => f.Name.FullName()) .Generate(100) .AsQueryable() .Page(mockPageable.Object); this.Invoking(f => { fake.As((Func <Customer, string>)null); }) .Should() .Throw <ArgumentNullException>(); }
public void ShouldBeToValid() { var mockPageable = new Mock <IRSqlPageable <Customer> >(); mockPageable.Setup(x => x.PageNumber()).Returns(10); mockPageable.Setup(x => x.PageSize()).Returns(2); mockPageable.Setup(x => x.Sort()).Returns((RSqlSort <Customer>)null); var fake = new Faker <Customer>() .RuleFor(c => c.Name, f => f.Name.FullName()) .Generate(100) .AsQueryable() .Page(mockPageable.Object); var expected = fake.As(c => c.Name); expected .Should() .NotBeNull(); }