예제 #1
0
 public IEnumerable <PetResultViewModel> GetPetNamesAccordingToGender()
 {
     try
     {
         var petOwnerResult = _PetDataService.GetPetDataFromService();
         if (petOwnerResult.Count() > 0)
         {
             var result = petOwnerResult
                          .GroupBy(o => o.Gender)
                          .Select(r => new PetResultViewModel
             {
                 Gender   = r.Key,
                 PetNames = r
                            .SelectManyIgnoringNull(co => co.Pets)
                            .Where(c => c.Type == Constant.CatKey)
                            .Select(c => c.Name)
                            .Distinct()
                            .OrderBy(pet => pet).ToList()
             }).ToList <PetResultViewModel>();
             return(result);
         }
         return(null);
     }
     catch (Exception ex)
     {
         Log.LogError(ex);
         throw;
     }
 }
        public void TestPetServiceReturnsResult()
        {
            //Act
            var result = _GetPetServiceData.GetPetDataFromService();

            //Assert
            Assert.IsNotNull(result);
        }