Beispiel #1
0
        public async Task GetNonExistentCategoryByIdIsDoesNotLog()
        {
            tlkpCategory category = await _pokedexRepository.GetCategoryById(-33);

            Assert.IsNull(category);

            _pokedexDBContextMock.Verify(m => m.tlkpCategory, Times.Once);
        }
Beispiel #2
0
        /// <summary>
        /// Get the category entity from a given categoryId.
        /// </summary>
        /// <param name="categoryId">categoryId to find</param>
        /// <returns>the found category entity</returns>
        public async Task <tlkpCategory> GetCategoryById(int categoryId)
        {
            tlkpCategory category = await _context.tlkpCategory.FindAsync(categoryId);

            if (category != null)
            {
                _logger.LogInformation(string.Format(InfoMessageWithId, Constants.Retrieved, Constants.Category, Constants.From, categoryId));
            }

            return(category);
        }
Beispiel #3
0
        public async Task GetCategoryByIdIsSuccessfulAndLogsInformation()
        {
            tlkpCategory category = await _pokedexRepository.GetCategoryById(3);

            Assert.AreEqual(3, category.Id);
            Assert.AreEqual("Name3", category.Name);

            _pokedexDBContextMock.Verify(m => m.tlkpCategory, Times.Once);

            VerifyLoggerMockLogsInformation("Retrieved Category from DBContext with Id: 3");
        }
Beispiel #4
0
        public async Task <GenericLookupResult> GetCategoryById(int id)
        {
            tlkpCategory category = await _pokedexRepository.GetCategoryById(id);

            _logger.LogInformation(Constants.Mapping + " " + Constants.Category + " " + Results + ".");

            return(category == null ? null : new GenericLookupResult()
            {
                Id = category.Id,
                Name = category.Name
            });
        }
Beispiel #5
0
 public override void Load_Header()
 {
     try
     {
         if (_CtyID > 0 && _CatID > 0)
         {
             //Setting Header property to be used in Header
             tlkpCategory cat = GoProGoDC.ProfileDC.GetCategoryByID(_CatID).SingleOrDefault <tlkpCategory>();
             tblCity      cit = GoProGoDC.GeoDC.GetCityByID(_CtyID).SingleOrDefault <tblCity>();
             _Header = "Service providers in " + cat.Name + " from " + cit.City;
             //TODO: Set this as header
             //((ICommon)Master).SetHeader(Header, MyAccountType.None);
         }
     }
     catch (Exception ex)
     {
         //TODO: logging here
     }
 }