public void GetByCategoryId_ShouldReturnCorrectAd() { System.Guid guid = new Guid("911b3163-0401-49e8-8589-68b86153bb68"); //category1 var response = controller.GetByCategoryId(guid); Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); var ad = response.Content.ReadAsAsync <IEnumerable <Ad> >().Result; Assert.AreEqual(ads.Where(c => c.Value.CategoryId == guid).Count(), ad.Count()); }