From 731b79519f8d4c130421c39cddf046a8df246b43 Mon Sep 17 00:00:00 2001 From: Chomp Date: Tue, 22 Jul 2025 20:43:08 +0100 Subject: [PATCH] Rename method to `GetItemWithChildren` --- .../Controllers/InsuranceController.cs | 2 +- .../Controllers/ProfileController.cs | 2 +- .../Controllers/QuestController.cs | 6 ++---- .../Controllers/RagfairController.cs | 6 +++--- .../Controllers/TradeController.cs | 2 +- .../Extensions/ItemExtensions.cs | 18 ++++++++--------- .../Extensions/TraderAssortExtensions.cs | 2 +- .../Generators/LocationLootGenerator.cs | 2 +- .../Helpers/BotGeneratorHelper.cs | 2 +- .../Helpers/InRaidHelper.cs | 4 ++-- .../Helpers/InventoryHelper.cs | 8 ++++---- .../Helpers/ItemHelper.cs | 2 +- .../Helpers/ProfileHelper.cs | 6 ++---- .../Helpers/TradeHelper.cs | 4 ++-- .../Models/Spt/Config/BotConfig.cs | 2 +- .../Services/CircleOfCultistService.cs | 2 +- .../Services/FenceService.cs | 16 +++++++-------- .../Services/RagfairTaxService.cs | 2 +- UnitTests/Tests/Extensions/ItemTests.cs | 20 +++++++++---------- 19 files changed, 52 insertions(+), 56 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs b/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs index dd00a38d..4b0b5667 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/InsuranceController.cs @@ -410,7 +410,7 @@ public class InsuranceController( if (parentAttachmentsMap.ContainsKey(insuredItem.Id)) { // This call will also return the parent item itself, queueing it for deletion as well. - var itemAndChildren = insured.Items.FindAndReturnChildrenAsItems( + var itemAndChildren = insured.Items.GetItemWithChildren( insuredItem.Id ); foreach (var item in itemAndChildren) diff --git a/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs b/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs index f631e4bc..5fa2618f 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/ProfileController.cs @@ -299,7 +299,7 @@ public class ProfileController( foreach (var rootItems in hideoutRootItems) { // Check each root items for children and add - var itemWithChildren = profileToViewPmc.Inventory.Items.FindAndReturnChildrenAsItems( + var itemWithChildren = profileToViewPmc.Inventory.Items.GetItemWithChildren( rootItems.Id ); itemsToReturn.AddRange(itemWithChildren); diff --git a/Libraries/SPTarkov.Server.Core/Controllers/QuestController.cs b/Libraries/SPTarkov.Server.Core/Controllers/QuestController.cs index d50b594d..58273c80 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/QuestController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/QuestController.cs @@ -312,9 +312,7 @@ public class QuestController( else { // Remove item with children - var toRemove = pmcData.Inventory.Items.FindAndReturnChildrenByItems( - itemHandover.Id - ); + var toRemove = pmcData.Inventory.Items.GetItemWithChildrenTpls(itemHandover.Id); var index = pmcData.Inventory.Items.Count; // Important: don't tell the client to remove the attachments, it will handle it @@ -335,7 +333,7 @@ public class QuestController( // element `location` properties of the parent so they are sequential, while retaining order if (removedItem.Location?.GetType() == typeof(int)) { - var childItems = pmcData.Inventory.Items.FindAndReturnChildrenAsItems( + var childItems = pmcData.Inventory.Items.GetItemWithChildren( removedItem.ParentId ); childItems.RemoveAt(0); // Remove the parent diff --git a/Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs b/Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs index 3d1652ec..784fc519 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/RagfairController.cs @@ -591,7 +591,7 @@ public class RagfairController( // multi-offers are all the same item, // Get first item and its children and use as template - var inventoryItems = pmcData.Inventory.Items.FindAndReturnChildrenAsItems( + var inventoryItems = pmcData.Inventory.Items.GetItemWithChildren( firstOfferItemId // Choose first item as they're all the same item ); @@ -707,7 +707,7 @@ public class RagfairController( // multi-offers are all the same item, // Get first item and its children and use as template - var firstInventoryItemAndChildren = pmcData.Inventory.Items.FindAndReturnChildrenAsItems( + var firstInventoryItemAndChildren = pmcData.Inventory.Items.GetItemWithChildren( offerRequest.Items.FirstOrDefault() ); @@ -1090,7 +1090,7 @@ public class RagfairController( rootItem.FixItemStackCount(); - itemsToReturn.Add(pmcData.Inventory.Items.FindAndReturnChildrenAsItems(itemId)); + itemsToReturn.Add(pmcData.Inventory.Items.GetItemWithChildren(itemId)); } if (itemsToReturn.Count == 0) diff --git a/Libraries/SPTarkov.Server.Core/Controllers/TradeController.cs b/Libraries/SPTarkov.Server.Core/Controllers/TradeController.cs index ba653692..a8ca63cb 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/TradeController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/TradeController.cs @@ -341,7 +341,7 @@ public class TradeController( TraderBase traderDetails ) { - var itemWithChildren = items.FindAndReturnChildrenAsItems(parentItemId); + var itemWithChildren = items.GetItemWithChildren(parentItemId); var totalPrice = 0; foreach (var itemToSell in itemWithChildren) diff --git a/Libraries/SPTarkov.Server.Core/Extensions/ItemExtensions.cs b/Libraries/SPTarkov.Server.Core/Extensions/ItemExtensions.cs index 769f6393..26743cb5 100644 --- a/Libraries/SPTarkov.Server.Core/Extensions/ItemExtensions.cs +++ b/Libraries/SPTarkov.Server.Core/Extensions/ItemExtensions.cs @@ -199,7 +199,7 @@ namespace SPTarkov.Server.Core.Extensions /// List of items (item + possible children) /// Parent item's id /// list of child item ids - public static List FindAndReturnChildrenByItems( + public static List GetItemWithChildrenTpls( this IEnumerable items, MongoId baseItemId ) @@ -210,7 +210,7 @@ namespace SPTarkov.Server.Core.Extensions { if (childItem.ParentId == baseItemId.ToString()) { - list.AddRange(FindAndReturnChildrenByItems(items, childItem.Id)); + list.AddRange(GetItemWithChildrenTpls(items, childItem.Id)); } } @@ -267,16 +267,16 @@ namespace SPTarkov.Server.Core.Extensions } /// - /// A variant of FindAndReturnChildren where the output is list of item objects instead of their ids. + /// Get an item with its attachments (children) /// /// List of items (item + possible children) /// Parent item's id - /// OPTIONAL - Include only mod items, exclude items stored inside root item + /// OPTIONAL - Include only mod items, exclude items stored inside root item /// list of Item objects - public static List FindAndReturnChildrenAsItems( + public static List GetItemWithChildren( this IEnumerable items, MongoId baseItemId, - bool modsOnly = false + bool excludeStoredItems = false ) { // Use dictionary to make key lookup faster, convert to list before being returned @@ -308,13 +308,13 @@ namespace SPTarkov.Server.Core.Extensions } // Is stored in parent and disallowed - if (modsOnly && item.Location is not null) + if (excludeStoredItems && item.Location is not null) { continue; } // Item may have children, check - foreach (var subItem in FindAndReturnChildrenAsItems(itemList, item.Id)) + foreach (var subItem in GetItemWithChildren(itemList, item.Id)) { result.Add(subItem.Id, subItem); } @@ -375,7 +375,7 @@ namespace SPTarkov.Server.Core.Extensions return []; } - var itemsInSecureContainer = items.FindAndReturnChildrenByItems(secureContainer.Id); + var itemsInSecureContainer = items.GetItemWithChildrenTpls(secureContainer.Id); // Return all items returned and exclude the secure container item itself return itemsInSecureContainer.Where(x => x != secureContainer.Id).ToList(); diff --git a/Libraries/SPTarkov.Server.Core/Extensions/TraderAssortExtensions.cs b/Libraries/SPTarkov.Server.Core/Extensions/TraderAssortExtensions.cs index 38740663..55a7bf1e 100644 --- a/Libraries/SPTarkov.Server.Core/Extensions/TraderAssortExtensions.cs +++ b/Libraries/SPTarkov.Server.Core/Extensions/TraderAssortExtensions.cs @@ -34,7 +34,7 @@ namespace SPTarkov.Server.Core.Extensions assort.LoyalLevelItems.Remove(itemId); // The item being removed may have children linked to it, find and remove them too - var idsToRemove = assort.Items.FindAndReturnChildrenByItems(itemId); + var idsToRemove = assort.Items.GetItemWithChildrenTpls(itemId); assort.Items.RemoveAll(item => idsToRemove.Contains(item.Id)); return assort; diff --git a/Libraries/SPTarkov.Server.Core/Generators/LocationLootGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/LocationLootGenerator.cs index c7251f66..c9d1a695 100644 --- a/Libraries/SPTarkov.Server.Core/Generators/LocationLootGenerator.cs +++ b/Libraries/SPTarkov.Server.Core/Generators/LocationLootGenerator.cs @@ -1170,7 +1170,7 @@ public class LocationLootGenerator( { // Also used by armors to get child mods // Get item + children and add into array we return - var itemWithChildren = lootItems.FindAndReturnChildrenAsItems(chosenItem.Id); + var itemWithChildren = lootItems.GetItemWithChildren(chosenItem.Id); // Ensure all IDs are unique itemWithChildren = _cloner.Clone(itemWithChildren).ReplaceIDs().ToList(); diff --git a/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs index b4ec8ec3..375ac726 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/BotGeneratorHelper.cs @@ -735,7 +735,7 @@ public class BotGeneratorHelper( // Check item in container for children, store for later insertion into `containerItemsToCheck` // (used later when figuring out how much space weapon takes up) List itemsToFilter = [.. itemsWithoutLocation, rootItem]; - var itemWithChildItems = itemsToFilter.FindAndReturnChildrenAsItems(rootItem.Id); + var itemWithChildItems = itemsToFilter.GetItemWithChildren(rootItem.Id); // Item had children, replace existing data with item + its children result.AddRange(itemWithChildItems); diff --git a/Libraries/SPTarkov.Server.Core/Helpers/InRaidHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/InRaidHelper.cs index 1ba40b24..403edee3 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/InRaidHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/InRaidHelper.cs @@ -80,12 +80,12 @@ public class InRaidHelper( ); // Get all items that have a parent of `serverProfile.Inventory.equipment` (All items player had on them at end of raid) - var postRaidInventoryItems = postRaidProfile.Inventory.Items.FindAndReturnChildrenAsItems( + var postRaidInventoryItems = postRaidProfile.Inventory.Items.GetItemWithChildren( postRaidProfile.Inventory.Equipment.Value ); // Get all items that have a parent of `serverProfile.Inventory.questRaidItems` (Quest items player had on them at end of raid) - var postRaidQuestItems = postRaidProfile.Inventory.Items.FindAndReturnChildrenAsItems( + var postRaidQuestItems = postRaidProfile.Inventory.Items.GetItemWithChildren( postRaidProfile.Inventory.QuestRaidItems.Value ); diff --git a/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs index bf31b821..83938713 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/InventoryHelper.cs @@ -492,7 +492,7 @@ public class InventoryHelper( } // Get children of item, they get deleted too - var itemAndChildrenToRemove = profile.Inventory.Items.FindAndReturnChildrenAsItems(itemId); + var itemAndChildrenToRemove = profile.Inventory.Items.GetItemWithChildren(itemId); if (!itemAndChildrenToRemove.Any()) { if (logger.IsLogEnabled(LogLevel.Debug)) @@ -569,7 +569,7 @@ public class InventoryHelper( if (messageWithReward is not null) { // Find item + any possible children and remove them from mails items array - var itemWithChildren = messageWithReward.Items.Data.FindAndReturnChildrenAsItems( + var itemWithChildren = messageWithReward.Items.Data.GetItemWithChildren( removeRequest.Item ); foreach (var itemToDelete in itemWithChildren) @@ -626,7 +626,7 @@ public class InventoryHelper( } // Goal is to keep removing items until we can remove part of an items stack - var itemsToReduce = pmcData.Inventory.Items.FindAndReturnChildrenAsItems(itemId); + var itemsToReduce = pmcData.Inventory.Items.GetItemWithChildren(itemId); var remainingCount = countToRemove; foreach (var itemToReduce in itemsToReduce) { @@ -1139,7 +1139,7 @@ public class InventoryHelper( HandleCartridgeMove(sourceItems, request); // Get all children item has, they need to move with item - var idsToMove = sourceItems.FindAndReturnChildrenByItems(request.Item.Value); + var idsToMove = sourceItems.GetItemWithChildrenTpls(request.Item.Value); foreach (var itemId in idsToMove) { var itemToMove = sourceItems.FirstOrDefault(item => item.Id == itemId); diff --git a/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs index 2d3fbb17..c8245085 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs @@ -1313,7 +1313,7 @@ public class ItemHelper( var forcedLeft = 0; var forcedRight = 0; - var children = items.FindAndReturnChildrenAsItems(rootItemId); + var children = items.GetItemWithChildren(rootItemId); foreach (var child in children) { var itemTemplate = GetItem(child.Template).Value; diff --git a/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs index dd16b3a7..338e4b61 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs @@ -373,9 +373,7 @@ public class ProfileHelper( if (secureContainer is not null) { // Find and remove container + children - var childItemsInSecureContainer = items.FindAndReturnChildrenByItems( - secureContainer.Id - ); + var childItemsInSecureContainer = items.GetItemWithChildrenTpls(secureContainer.Id); // Remove child items + secure container profile.Inventory.Items = items @@ -646,7 +644,7 @@ public class ProfileHelper( foreach (var itemId in profile.Inventory?.FavoriteItems ?? []) { // When viewing another users profile, the client expects a full item with children, so get that - var itemAndChildren = profile.Inventory.Items.FindAndReturnChildrenAsItems(itemId); + var itemAndChildren = profile.Inventory.Items.GetItemWithChildren(itemId); if (itemAndChildren?.Count > 0) { // To get the client to actually see the items, we set the main item's parent to null, so it's treated as a root item diff --git a/Libraries/SPTarkov.Server.Core/Helpers/TradeHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/TradeHelper.cs index e48a1bc7..91f76d6f 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/TradeHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/TradeHelper.cs @@ -154,7 +154,7 @@ public class TradeHelper( return; } - offerItems = fenceItems.FindAndReturnChildrenAsItems(buyRequestData.ItemId); + offerItems = fenceItems.GetItemWithChildren(buyRequestData.ItemId); } else { @@ -222,7 +222,7 @@ public class TradeHelper( .Items; // Get item + children for purchase - var relevantItems = traderItems.FindAndReturnChildrenAsItems(buyRequestData.ItemId); + var relevantItems = traderItems.GetItemWithChildren(buyRequestData.ItemId); if (relevantItems.Count == 0) { logger.Error( diff --git a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotConfig.cs b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotConfig.cs index e64bb452..90cd9104 100644 --- a/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotConfig.cs +++ b/Libraries/SPTarkov.Server.Core/Models/Spt/Config/BotConfig.cs @@ -188,7 +188,7 @@ public record WalletLootSettings /// What wallets will have money in them /// [JsonPropertyName("walletTplPool")] - public required List WalletTplPool { get; set; } + public required List WalletTplPool { get; set; } } public record EquipmentFilters diff --git a/Libraries/SPTarkov.Server.Core/Services/CircleOfCultistService.cs b/Libraries/SPTarkov.Server.Core/Services/CircleOfCultistService.cs index 3ff80662..97a75930 100644 --- a/Libraries/SPTarkov.Server.Core/Services/CircleOfCultistService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/CircleOfCultistService.cs @@ -333,7 +333,7 @@ public class CircleOfCultistService( List sacrificedItems = []; foreach (var rootItem in inventoryRootItemsInCultistGrid) { - var rootItemWithChildren = pmcData.Inventory.Items.FindAndReturnChildrenAsItems( + var rootItemWithChildren = pmcData.Inventory.Items.GetItemWithChildren( rootItem.Id ); sacrificedItems.AddRange(rootItemWithChildren); diff --git a/Libraries/SPTarkov.Server.Core/Services/FenceService.cs b/Libraries/SPTarkov.Server.Core/Services/FenceService.cs index 00bd665a..712e9525 100644 --- a/Libraries/SPTarkov.Server.Core/Services/FenceService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/FenceService.cs @@ -146,7 +146,7 @@ public class FenceService( { // HUGE THANKS TO LACYWAY AND LEAVES FOR PROVIDING THIS SOLUTION FOR SPT TO IMPLEMENT!! // Copy the item and its children - var clonedItems = _cloner.Clone(items.FindAndReturnChildrenAsItems(mainItem.Id)); + var clonedItems = _cloner.Clone(items.GetItemWithChildren(mainItem.Id)); // I BLAME LACY FOR THIS ISSUE, I SPENT HOURS FIXING IT /s // i think on node the one with hideout usually came first var root = clonedItems.FirstOrDefault(x => x.SlotId == "hideout"); @@ -422,7 +422,7 @@ public class FenceService( // Check if same type of item exists + its on list of item types to always stack if (existingRootItem != null && ItemInPreventDupeCategoryList(newRootItem.Template)) { - var existingFullItemTree = existingFenceAssorts.Items.FindAndReturnChildrenAsItems( + var existingFullItemTree = existingFenceAssorts.Items.GetItemWithChildren( existingRootItem.Id ); if ( @@ -578,7 +578,7 @@ public class FenceService( } // Remove item + child mods (if any) - var itemWithChildren = assort.Items.FindAndReturnChildrenAsItems(rootItemToAdjust.Id); + var itemWithChildren = assort.Items.GetItemWithChildren(rootItemToAdjust.Id); foreach (var itemToDelete in itemWithChildren) // Delete item from assort items array { @@ -857,7 +857,7 @@ public class FenceService( // MUST randomise Ids as its possible to add the same base fence assort twice = duplicate IDs = dead client var desiredAssortItemAndChildrenClone = _cloner .Clone( - childItemsAndSingleRoot.FindAndReturnChildrenAsItems(chosenBaseAssortRoot.Id) + childItemsAndSingleRoot.GetItemWithChildren(chosenBaseAssortRoot.Id) ) .ReplaceIDs() .ToList(); @@ -1112,7 +1112,7 @@ public class FenceService( var rootItemDb = itemHelper.GetItem(randomPresetRoot.Template).Value; var presetWithChildrenClone = _cloner.Clone( - baseFenceAssort.Items.FindAndReturnChildrenAsItems(randomPresetRoot.Id) + baseFenceAssort.Items.GetItemWithChildren(randomPresetRoot.Id) ); RandomiseItemUpdProperties(rootItemDb, presetWithChildrenClone[0]); @@ -1192,7 +1192,7 @@ public class FenceService( var rootItemDb = itemHelper.GetItem(randomPresetRoot.Template).Value; var presetWithChildrenClone = _cloner.Clone( - baseFenceAssort.Items.FindAndReturnChildrenAsItems(randomPresetRoot.Id) + baseFenceAssort.Items.GetItemWithChildren(randomPresetRoot.Id) ); // Need to add mods to armors so they don't show as red in the trade screen @@ -1488,7 +1488,7 @@ public class FenceService( } // Remove item and its sub-items to prevent orphans - toDelete.UnionWith(itemAndMods.FindAndReturnChildrenByItems(itemMod.Id)); + toDelete.UnionWith(itemAndMods.GetItemWithChildrenTpls(itemMod.Id)); } } @@ -1790,7 +1790,7 @@ public class FenceService( protected void DeleteOffer(MongoId assortId, List assorts) { // Assort could have child items, remove those too - var itemWithChildrenToRemove = assorts.FindAndReturnChildrenAsItems(assortId); + var itemWithChildrenToRemove = assorts.GetItemWithChildren(assortId); foreach (var itemToRemove in itemWithChildrenToRemove) { var indexToRemove = assorts.FindIndex(item => item.Id == itemToRemove.Id); diff --git a/Libraries/SPTarkov.Server.Core/Services/RagfairTaxService.cs b/Libraries/SPTarkov.Server.Core/Services/RagfairTaxService.cs index 887ec396..4182eba6 100644 --- a/Libraries/SPTarkov.Server.Core/Services/RagfairTaxService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/RagfairTaxService.cs @@ -164,7 +164,7 @@ public class RagfairTaxService( if (isRootItem) { // Since we get a flat list of all child items, we only want to recurse from parent item - var itemChildren = pmcData.Inventory.Items.FindAndReturnChildrenAsItems(item.Id); + var itemChildren = pmcData.Inventory.Items.GetItemWithChildren(item.Id); if (itemChildren.Count > 1) { var itemChildrenClone = cloner.Clone(itemChildren); // Clone is expensive, only run if necessary diff --git a/UnitTests/Tests/Extensions/ItemTests.cs b/UnitTests/Tests/Extensions/ItemTests.cs index 66a09cb3..daa3a63d 100644 --- a/UnitTests/Tests/Extensions/ItemTests.cs +++ b/UnitTests/Tests/Extensions/ItemTests.cs @@ -12,7 +12,7 @@ public class ItemTests public void Initialize() { } [Test] - public void FindAndReturnChildrenAsItems_one_child_mods_only() + public void GetItemWithChildren_one_child_mods_only() { var testData = new List(); var rootItem = new Item @@ -29,13 +29,13 @@ public class ItemTests testData.Add(rootItem); testData.Add(childItem); - var result = testData.FindAndReturnChildrenAsItems(rootItem.Id, true); + var result = testData.GetItemWithChildren(rootItem.Id, true); Assert.AreEqual(result[1].Id, childItem.Id); } [Test] - public void FindAndReturnChildrenAsItems_mods_only_one_inventory_item() + public void GetItemWithChildren_mods_only_one_inventory_item() { var testData = new List(); var rootItem = new Item @@ -60,14 +60,14 @@ public class ItemTests testData.Add(childItem); testData.Add(childItem2); - var result = testData.FindAndReturnChildrenAsItems(rootItem.Id, true); + var result = testData.GetItemWithChildren(rootItem.Id, true); Assert.AreEqual(result[1].Id, childItem2.Id); Assert.AreEqual(result.Count, 2); } [Test] - public void FindAndReturnChildrenAsItems_mods_and_inventory_item() + public void GetItemWithChildren_mods_and_inventory_item() { var testData = new List(); var rootItem = new Item @@ -92,14 +92,14 @@ public class ItemTests testData.Add(childItem); testData.Add(childItem2); - var result = testData.FindAndReturnChildrenAsItems(rootItem.Id, false); + var result = testData.GetItemWithChildren(rootItem.Id, false); Assert.AreEqual(result[1].Id, childItem.Id); Assert.AreEqual(result.Count, 3); } [Test] - public void FindAndReturnChildrenAsItems_mod_with_child() + public void GetItemWithChildren_mod_with_child() { var testData = new List(); var rootItem = new Item @@ -123,14 +123,14 @@ public class ItemTests testData.Add(childItem); testData.Add(childOfChild); - var result = testData.FindAndReturnChildrenAsItems(rootItem.Id, true); + var result = testData.GetItemWithChildren(rootItem.Id, true); Assert.AreEqual(result[1].Id, childItem.Id); Assert.AreEqual(result.Count, 3); } [Test] - public void FindAndReturnChildrenAsItems_no_matching_children() + public void GetItemWithChildren_no_matching_children() { var testData = new List(); var rootItem = new Item @@ -154,7 +154,7 @@ public class ItemTests testData.Add(childItem); testData.Add(childOfChild); - var result = testData.FindAndReturnChildrenAsItems(rootItem.Id, true); + var result = testData.GetItemWithChildren(rootItem.Id, true); Assert.AreEqual(result[0].Id, rootItem.Id); Assert.AreEqual(result.Count, 1);