Exemplo n.º 1
0
        public async Task Maps_Name_From_Email_In_Claim()
        {
            var presentId = Guid.NewGuid();
            var idOfCreator = Guid.NewGuid();
            var secondPersonId = Guid.NewGuid();
            var thirdPersonId = Guid.NewGuid();


            var wishlist =
                new WishlistBuilder(idOfCreator)
                    .AddPerson(secondPersonId)
                    .AddPerson(thirdPersonId)
                    .AddPresentIdea(secondPersonId, "desc 1", presentId)
                    .AddClaimer(presentId, thirdPersonId)
                    .Build();


            IUserRepository wishlistSummariesRepo = new InMemoryWishlistSummaryRepository();
            await wishlistSummariesRepo.AddWishlistToPerson(idOfCreator, wishlist.Id);
            await wishlistSummariesRepo.AddWishlistToPerson(secondPersonId, wishlist.Id);
            await wishlistSummariesRepo.AddWishlistToPerson(thirdPersonId, wishlist.Id);
            await wishlistSummariesRepo.SetEmailAndName(secondPersonId, "*****@*****.**", "Second person");
            await wishlistSummariesRepo.SetEmailAndName(thirdPersonId, "*****@*****.**", "Third person");

            var mapper = new WishlistMapper(wishlistSummariesRepo);
            var model = await mapper.Map(wishlist);
            var presentIdeaModels = model.People
                .Single(s => s.PersonId == secondPersonId)
                .PresentIdeas;
            var claimer = presentIdeaModels
                .Single(s => s.Id == presentId);

            claimer.ClaimerName.Should().Be("Third person");            
            claimer.ClaimerEmail.Should().Be("*****@*****.**");
        }
Exemplo n.º 2
0
        public async Task <WishlistIndexViewModel> GetIndexAsync(int hoarderID)
        {
            var wishlistItems = await wishlistDbService.GetAllAsync(hoarderID);

            var vm = WishlistMapper.ToIndexViewModel(wishlistItems);

            return(vm);
        }
Exemplo n.º 3
0
        public async Task <WishlistCreateViewModel> GetCreateDataAsync(int hoarderID)
        {
            var itemTypeList = await wishlistItemTypeDbService.GetAllAsync();

            var priorityList = await priorityDbService.GetAllAsync();

            var languageList = await languageDbService.GetAllAsync();

            return(WishlistMapper.ToCreateViewModel(hoarderID, itemTypeList, priorityList, languageList));
        }
Exemplo n.º 4
0
        public List <WishlistGridModel> GetMyWishlist(string ownerId, Guid countryId)
        {
            List <WishlistGridModel> listGridModel = new List <WishlistGridModel>();
            var wishlists = _repository.GetAll(ownerId, countryId);

            foreach (var wishlist in wishlists)
            {
                listGridModel.Add(WishlistMapper.MapToWishlistGridModel(wishlist, _adService.GetAdAsAdWishlistGridModel(wishlist.AdId)));
            }

            return(listGridModel);
        }
Exemplo n.º 5
0
 public WishlistController(
     WishlistMapper wishlistMapper,
     IWishlistRepository repository,
     IUserRepository wishlistSummaryRepository,
     IMediator mediator, IUpdateWishlistHub updateWishlistHub)
 {
     this.wishlistMapper        = wishlistMapper;
     _repository                = repository;
     _wishlistSummaryRepository = wishlistSummaryRepository;
     _mediator          = mediator;
     _updateWishlistHub = updateWishlistHub;
 }
Exemplo n.º 6
0
        public async Task <WishlistUpdateViewModel> GetUpdateDataAsync(int id)
        {
            var item = await wishlistDbService.GetUpdateDataAsync(id);

            var itemTypeList = await wishlistItemTypeDbService.GetAllAsync();

            var priorityList = await priorityDbService.GetAllAsync();

            var languageList = await languageDbService.GetAllAsync();

            return(WishlistMapper.ToUpdateViewModel(item, itemTypeList, priorityList, languageList));
        }
Exemplo n.º 7
0
        public async Task <bool> UpdateResultsInDuplicateEntryAsync(WishlistUpdateViewModel wishlistUpdateViewModel)
        {
            var updatedItem = WishlistMapper.ToExistingWishlistItem(wishlistUpdateViewModel);

            return(await wishlistDbService.CommandResultsInDuplicateEntryAsync(updatedItem));
        }
Exemplo n.º 8
0
        public async Task <bool> CreateResultsInDuplicateEntryAsync(WishlistCreateViewModel wishlistCreateViewModel)
        {
            var newItem = WishlistMapper.ToNewWishlistItem(wishlistCreateViewModel);

            return(await wishlistDbService.CommandResultsInDuplicateEntryAsync(newItem));
        }
Exemplo n.º 9
0
        public async Task UpdateAsync(WishlistUpdateViewModel wishlistUpdateViewModel)
        {
            var updatedItem = WishlistMapper.ToExistingWishlistItem(wishlistUpdateViewModel);

            await wishlistDbService.UpdateAsync(updatedItem);
        }
Exemplo n.º 10
0
        public async Task CreateAsync(WishlistCreateViewModel wishlistCreateViewModel)
        {
            var newItem = WishlistMapper.ToNewWishlistItem(wishlistCreateViewModel);

            await wishlistDbService.CreateAsync(newItem);
        }