public void MapRandomTest()
        {
            IEnumerable <string> randomPlaceToStay   = this.MakeRandomPlaceToStay();
            IEnumerable <IEnumerable <string> > data = new List <IEnumerable <string> >()
            {
                randomPlaceToStay, randomPlaceToStay
            };

            List <PlacesToStay> placesToStays = placeToStayMapper.Map(data);

            Assert.IsNotNull(placesToStays);
            Assert.AreEqual(1, placesToStays.Count);

            PlacesToStay toStay = placesToStays.Single();

            string[] arrayedPlaceToStay = randomPlaceToStay.ToArray();

            Assert.AreEqual(arrayedPlaceToStay[0], toStay.Id.ToString());
            Assert.AreEqual(arrayedPlaceToStay[1], toStay.CategoryId.ToString());
            Assert.AreEqual(arrayedPlaceToStay[2], toStay.CategoryTypeId.ToString());
            Assert.AreEqual(arrayedPlaceToStay[3], toStay.City);
            Assert.AreEqual(arrayedPlaceToStay[4], toStay.Region);
            Assert.AreEqual(arrayedPlaceToStay[5], toStay.LocationDescription);
            Assert.AreEqual(arrayedPlaceToStay[6], toStay.Url);
            Assert.AreEqual(arrayedPlaceToStay[7], toStay.HealthPoints.ToString());
            Assert.AreEqual(arrayedPlaceToStay[8], toStay.GreenKeyRating.ToString());
            Assert.AreEqual(arrayedPlaceToStay[9], toStay.Status);
            Assert.AreEqual(arrayedPlaceToStay[10], toStay.RevisionNumber.ToString());
            Assert.AreEqual(arrayedPlaceToStay[11], toStay.OriginalPublishedDate.ToString());
            Assert.AreEqual(arrayedPlaceToStay[12], toStay.LinkName);
            Assert.AreEqual(arrayedPlaceToStay[13], toStay.ClientId);
            Assert.AreEqual(arrayedPlaceToStay[14], toStay.Name);
            Assert.AreEqual(arrayedPlaceToStay[15], toStay.IsDataProvider.ToString());
        }
Beispiel #2
0
 private async Task <TEntity> UpdateAsync(TEntity entity, string ruleset)
 {
     return(await ServiceHelper.TryCatchWithLogger(async() =>
     {
         await Task.Delay(1);
         TEntity entityTransformed = SetEntityIncludeOnUpdate(_repositoryAsync.Query(f => f.UniqueId == entity.UniqueId)).Select().Single();
         if (ExecuteMappingBeforeUpdate())
         {
             entityTransformed = _mapper.Map(entity, entityTransformed);
         }
         entityTransformed = BeforeUpdate(entity, entityTransformed);
         _validationService.Validate(entityTransformed, ruleset);
         _repositoryAsync.Update(entityTransformed);
         entityTransformed = AfterUpdate(entity, entityTransformed);
         return entityTransformed;
     }, _logger, LogCategories));
 }
        /// <summary>
        /// Gets all todos for the user.
        /// </summary>
        /// <returns>The list of todos.</returns>
        public IEnumerable <TaskDto> GetTasks()
        {
            List <TaskDto> listOfTasks = _unitOfWork.Tasks.GetTasks().Select(task => _mapper.Map <TaskDto>(task)).ToList();

            return(listOfTasks);
        }