public async Task ExchangeItemAsync_WithNewItemAvailableForShoppingListAndNotInBasket_ShouldRemoveOldItemAndAddNewItem() { // Arrange var local = new LocalFixture(); var service = local.CreateService(); ShoppingListMock shoppingListMock = local.CreateShoppingListMockNotInBasket(); var shopppingListStoreId = shoppingListMock.Object.StoreId; IShoppingListItem oldShoppingListItem = shoppingListMock.GetRandomItem(local.CommonFixture, i => !i.IsInBasket); ItemId oldItemId = oldShoppingListItem.Id; IStoreItem newItem = local.CreateNewItemForStore(shopppingListStoreId); local.ShoppingListRepositoryMock.SetupFindActiveByAsync(oldItemId, shoppingListMock.Object.ToMonoList()); // Act await service.ExchangeItemAsync(oldItemId, newItem, default); // Assert var sectionId = newItem.Availabilities.First(av => av.StoreId == shopppingListStoreId).DefaultSectionId; using (new AssertionScope()) { shoppingListMock.VerifyRemoveItemOnce(oldItemId); local.ShoppingListRepositoryMock.VerifyStoreAsyncOnce(shoppingListMock.Object); local.AddItemToShoppingListServiceMock.VerifyAddItemToShoppingListOnce(shoppingListMock.Object, newItem.Id, sectionId, oldShoppingListItem.Quantity); shoppingListMock.VerifyPutItemInBasketNever(); } }