public void FilterByManyCatalogueStatus() { var items = new List <Item> { new Item( ItemId.From("1"), ItemName.From("acoustic guitar"), CatalogueStatus.NOT_FOR_SALE, Source.CRAFTING, Image.From("https://acnhcdn.com/latest/FtrIcon/FtrAcorsticguitar_Remake_0_0.png"), null ), new Item( ItemId.From("1"), ItemName.From("formal paper"), CatalogueStatus.FOR_SALE, Source.CRAFTING, Image.From("https://acnhcdn.com/latest/FtrIcon/FtrAcorsticguitar_Remake_0_0.png"), null ) }; var service = new InMemoryItemService(items); var actual = service.List( new ItemFilter("", new List <CatalogueStatus> { CatalogueStatus.FOR_SALE, CatalogueStatus.NOT_FOR_SALE }, new List <Source>()), new PageCursor(100, 0) ); actual.Count.Should().Be(2); actual.Items.Should().HaveCount(2); actual.Items.Should().Contain(items); }
public void ItemWithoutVariant() { var item = new Item( ItemId.From("1"), ItemName.From("acoustic guitar"), CatalogueStatus.NOT_FOR_SALE, Source.CRAFTING, Image.From("https://acnhcdn.com/latest/FtrIcon/FtrAcorsticguitar_Remake_0_0.png"), null ); var items = new List <Item> { item }; var service = new InMemoryItemService(items); var actual = service.Get(item.Id, null); actual.Should().Be(item); }
public List <Items> LookingForThisItem(List <SubsInventory> subs, int user_id) { List <Items> returnList = new List <Items>(); InMemoryItemService itemService = new InMemoryItemService(); List <Items> AllItems = itemService.RefreshItems(); for (int i = 0; i < subs.Count; i++) { if (subs[i]._user_id == user_id) { for (int j = 0; j < AllItems.Count; j++) { if (subs[i]._item_id == AllItems[j].item_id) { returnList.Add(AllItems[j]); } } } } return(returnList); }
public void ItemNotExists() { var item = new Item( ItemId.From("1"), ItemName.From("acoustic guitar"), CatalogueStatus.NOT_FOR_SALE, Source.CRAFTING, Image.From("https://acnhcdn.com/latest/FtrIcon/FtrAcorsticguitar_Remake_0_0.png"), new ItemVariant( ItemVariantId.From("1_0"), ItemVariantName.From("Natural") ) ); var items = new List <Item> { item }; var service = new InMemoryItemService(items); FluentActions .Invoking(() => service.Get(ItemId.From("1234"), null)) .Should().Throw <InvalidOperationException>(); }
public void ItemWithVariants() { var item1 = new Item( ItemId.From("1"), ItemName.From("acoustic guitar"), CatalogueStatus.NOT_FOR_SALE, Source.CRAFTING, Image.From("https://acnhcdn.com/latest/FtrIcon/FtrAcorsticguitar_Remake_0_0.png"), new ItemVariant( ItemVariantId.From("0_0"), ItemVariantName.From("Natural") ) ); var item2 = new Item( ItemId.From("1"), ItemName.From("acoustic guitar"), CatalogueStatus.NOT_FOR_SALE, Source.CRAFTING, Image.From("https://acnhcdn.com/latest/FtrIcon/FtrAcorsticguitar_Remake_0_0.png"), new ItemVariant( ItemVariantId.From("1_0"), ItemVariantName.From("Natural") ) ); var items = new List <Item> { item1, item2 }; var service = new InMemoryItemService(items); var actual = service.GroupByVariants(); actual.Should().ContainKeys(item1.Id); actual[item1.Id].Should().HaveCount(2); actual[item1.Id][0].Id.Should().Be(item1.Id); actual[item1.Id][0].Id.Should().Be(item2.Id); }