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("*****@*****.**"); }
public async Task Test_AddPerson_Wishlist() { var idOfCreator = Guid.NewGuid(); var wishlist = Wishlist.Create("a", idOfCreator, true); await this.inMemoryRepository.Save(wishlist); await inMemorySummaryRepository.CreatePerson(idOfCreator, "a", "a"); await inMemorySummaryRepository.AddWishlistToPerson(idOfCreator, wishlist.Id); var response = await client.PostAsync($"/wishlist/addPerson?wishlistId={wishlist.Id.ToString()}&name=Ed&email=ed&isGiftee=true", new StringContent("")); response.EnsureSuccessStatusCode(); inMemoryRepository._wishlists.Count.Should().BeGreaterThan(0); inMemoryRepository._wishlists.Single().Value.People.Count.Should().Be(2); var creatorDetails = await inMemorySummaryRepository.GetUser(idOfCreator); creatorDetails.Wishlists.Count().Should().Be(1); }