public void FilterNinjasByName() { var filterNinjaByNameSpecification = new FilterNinjaByNameSpecification("the ninja"); var ninjasFound = _ninjas.Where(filterNinjaByNameSpecification.IsSatisfiedBy).ToList(); Assert.AreEqual(1, ninjasFound.Count); Assert.AreEqual("the ninja", ninjasFound.First().Name); }
public void FilterNinjasByDateOfBirthOrNameWithoutOperands() { var filterNinjaByNameSpecification = new FilterNinjaByNameSpecification("the ninja"); var filterNinjaByDateOfBirthSpecification = new FilterNinjaByDateOfBirthSpecification(new DateTime(1950, 10, 28)); var ninjasFound = _ninjas.Where(filterNinjaByNameSpecification.Or(filterNinjaByDateOfBirthSpecification).IsSatisfiedBy).ToList(); Assert.AreEqual(2, ninjasFound.Count); }
public void FilterNinjasByDateOfBirthAndNameWithoutOperands() { var filterNinjaByNameSpecification = new FilterNinjaByNameSpecification("the ninja"); var filterNinjaByDateOfBirthSpecification = new FilterNinjaByDateOfBirthSpecification(new DateTime(1982, 4, 23)); var ninjasFound = _ninjas.Where(filterNinjaByNameSpecification.And(filterNinjaByDateOfBirthSpecification).IsSatisfiedBy).ToList(); Assert.AreEqual(1, ninjasFound.Count); Assert.AreEqual("the ninja", ninjasFound.First().Name); }