Exemple #1
0
 // GET api/<controller>
 public IEnumerable <PersonModel> Get(string filter = "")
 {
     if (!string.IsNullOrEmpty(filter))
     {
         return(service.Contains(filter).AsEnumerable());
     }
     else
     {
         return(service.GetAll().AsEnumerable());
     }
 }
Exemple #2
0
        public void PeopleServiceContainsTest()
        {
            // ARRANGE
            string searchText = "ar";

            // ACT
            var results = service.Contains(searchText);

            // ASSERT

            // Expecting at least Tony Start, Carol Danvers, and Clint Barton from the seed data
            Assert.That(results.Count >= 3);
            Assert.That(results.Any(x => x.FirstName == "Tony" && x.LastName == "Stark"));
        }