コード例 #1
0
 public List <Badge> GetAllBadges()
 {
     try
     {
         return(_service.GetAllBadges());
     }
     catch (Exception e)
     {
         throw e;
     }
 }
コード例 #2
0
        public IHttpActionResult AllBadges()
        {
            var badges = _badgeService.GetAllBadges();

            if (badges != null)
            {
                var badgeDTOs = badges as List <BadgeDTO> ?? badges.ToList();
                if (badgeDTOs.Any())
                {
                    return(Ok(badgeDTOs));
                }
            }
            return(NotFound());
        }
コード例 #3
0
        public void WhenGettingAllBadges_AssertReturnedCollection()
        {
            var badges = _badgeService.GetAllBadges();

            Assert.Equal(DataInitializer.GetAllBadges().Count, badges.Count());
        }