Merge pull request #539 from CJ-SPT/test-mod
Intoduce test mod and restructure test suites into their own solution folder
This commit is contained in:
@@ -0,0 +1,306 @@
|
||||
using NUnit.Framework;
|
||||
using SPTarkov.Server.Core.Extensions;
|
||||
|
||||
namespace UnitTests.Tests.Extensions;
|
||||
|
||||
[TestFixture]
|
||||
public partial class ContainerExtensionsTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Initialize() { }
|
||||
|
||||
[Test]
|
||||
public void CanItemBePlacedInContainerAtPosition_1x1_Item_Fits_1x2_Container_At_0x0()
|
||||
{
|
||||
var container = new int[1, 2];
|
||||
var itemStartXPos = 0;
|
||||
var itemStartYPos = 0;
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 1;
|
||||
|
||||
var result = container.CanItemBePlacedInContainerAtPosition(itemStartXPos, itemStartYPos, itemWidth, itemHeight);
|
||||
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanItemBePlacedInContainerAtPosition_1x1_Item_Fails_1x2_Container_At_0x0_With_Item_At_0x0()
|
||||
{
|
||||
var container = new int[1, 2];
|
||||
container[0, 0] = 1;
|
||||
var itemStartXPos = 0;
|
||||
var itemStartYPos = 0;
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 1;
|
||||
|
||||
var result = container.CanItemBePlacedInContainerAtPosition(itemStartXPos, itemStartYPos, itemWidth, itemHeight);
|
||||
|
||||
Assert.IsFalse(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanItemBePlacedInContainerAtPosition_1x2_Item_Fits_1x2_Container_At_0x0()
|
||||
{
|
||||
var container = new int[2, 1];
|
||||
var itemStartXPos = 0;
|
||||
var itemStartYPos = 0;
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 2;
|
||||
|
||||
var result = container.CanItemBePlacedInContainerAtPosition(itemStartXPos, itemStartYPos, itemWidth, itemHeight);
|
||||
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanItemBePlacedInContainerAtPosition_1x2_Item_Fails_1x2_Container_At_0x0_With_Item_At_0x0()
|
||||
{
|
||||
var container = new int[1, 2];
|
||||
container[0, 0] = 1;
|
||||
var itemStartXPos = 0;
|
||||
var itemStartYPos = 0;
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 2;
|
||||
|
||||
var result = container.CanItemBePlacedInContainerAtPosition(itemStartXPos, itemStartYPos, itemWidth, itemHeight);
|
||||
|
||||
Assert.IsFalse(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanItemBePlacedInContainerAtPosition_2x2_Item_Fits_2x2_Container_At_0x0()
|
||||
{
|
||||
var container = new int[2, 2];
|
||||
var itemStartXPos = 0;
|
||||
var itemStartYPos = 0;
|
||||
var itemWidth = 2;
|
||||
var itemHeight = 2;
|
||||
|
||||
var result = container.CanItemBePlacedInContainerAtPosition(itemStartXPos, itemStartYPos, itemWidth, itemHeight);
|
||||
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CanItemBePlacedInContainerAtPosition_1x2_Item_Fits_2x2_Container_At_0x1()
|
||||
{
|
||||
var container = new int[2, 2];
|
||||
var itemStartXPos = 0;
|
||||
var itemStartYPos = 1;
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 2;
|
||||
|
||||
var result = container.CanItemBePlacedInContainerAtPosition(itemStartXPos, itemStartYPos, itemWidth, itemHeight);
|
||||
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ContainerExtensionsTests
|
||||
{
|
||||
[Test]
|
||||
public void FindSlotForItem_1x1_item_fits_1x1_container_no_rotation()
|
||||
{
|
||||
var container = new int[1, 1];
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 1;
|
||||
|
||||
var result = container.FindSlotForItem(itemWidth, itemHeight);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
Assert.IsFalse(result.Rotation);
|
||||
Assert.AreEqual(result.X, 0);
|
||||
Assert.AreEqual(result.Y, 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FindSlotForItem_1x2_item_fits_3x3_container_rotated_with_items()
|
||||
{
|
||||
// |1|1|1|
|
||||
// |1|0|0|
|
||||
// |1|1|1|
|
||||
var container = new int[3, 3];
|
||||
container[0, 0] = 1;
|
||||
container[0, 1] = 1;
|
||||
container[0, 2] = 1;
|
||||
container[1, 0] = 1;
|
||||
container[2, 0] = 1;
|
||||
container[2, 1] = 1;
|
||||
container[2, 2] = 1;
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 2;
|
||||
|
||||
var result = container.FindSlotForItem(itemWidth, itemHeight);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
Assert.IsTrue(result.Rotation);
|
||||
Assert.AreEqual(result.X, 1);
|
||||
Assert.AreEqual(result.Y, 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FindSlotForItem_1x1_item_fails_1x1_container_no_space()
|
||||
{
|
||||
var container = new int[1, 1];
|
||||
container[0, 0] = 1;
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 1;
|
||||
|
||||
var result = container.FindSlotForItem(itemWidth, itemHeight);
|
||||
|
||||
Assert.IsFalse(result.Success);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FindSlotForItem_1x2_item_fits_1x2_container_no_rotation()
|
||||
{
|
||||
var container = new int[2, 1];
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 2;
|
||||
|
||||
var result = container.FindSlotForItem(itemWidth, itemHeight);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
Assert.IsFalse(result.Rotation);
|
||||
Assert.AreEqual(result.X, 0);
|
||||
Assert.AreEqual(result.Y, 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FindSlotForItem_1x2_item_fails_1x2_container_no_space()
|
||||
{
|
||||
var container = new int[1, 1];
|
||||
container[0, 0] = 1;
|
||||
container[0, 0] = 1;
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 2;
|
||||
|
||||
var result = container.FindSlotForItem(itemWidth, itemHeight);
|
||||
|
||||
Assert.IsFalse(result.Success);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FindSlotForItem_2x2_item_fits_2x2_container_no_rotation()
|
||||
{
|
||||
var container = new int[2, 2];
|
||||
var itemWidth = 2;
|
||||
var itemHeight = 2;
|
||||
|
||||
var result = container.FindSlotForItem(itemWidth, itemHeight);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
Assert.IsFalse(result.Rotation);
|
||||
Assert.AreEqual(result.X, 0);
|
||||
Assert.AreEqual(result.Y, 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FindSlotForItem_1x2_item_fits_2x2_container_no_rotation_with_item_at_0x0()
|
||||
{
|
||||
var container = new int[2, 2];
|
||||
container[0, 0] = 1;
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 2;
|
||||
|
||||
var result = container.FindSlotForItem(itemWidth, itemHeight);
|
||||
|
||||
Assert.IsTrue(result.Success);
|
||||
Assert.IsFalse(result.Rotation);
|
||||
Assert.AreEqual(result.X, 1);
|
||||
Assert.AreEqual(result.Y, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class ContainerExtensionsTests
|
||||
{
|
||||
[Test]
|
||||
public void FillContainerMapWithItem_1x1_at_0x0_in_1x1_no_rotation()
|
||||
{
|
||||
var container = new int[1, 1];
|
||||
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 1;
|
||||
|
||||
var destinationPosX = 0;
|
||||
var destinationPosY = 0;
|
||||
var isRotated = false;
|
||||
|
||||
container.FillContainerMapWithItem(destinationPosX, destinationPosY, itemWidth, itemHeight, isRotated);
|
||||
|
||||
Assert.AreEqual(container[0, 0], 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FillContainerMapWithItem_1x2_at_0x0_in_1x2_no_rotation()
|
||||
{
|
||||
var container = new int[2, 1];
|
||||
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 2;
|
||||
|
||||
var destinationPosX = 0;
|
||||
var destinationPosY = 0;
|
||||
var isRotated = false;
|
||||
|
||||
container.FillContainerMapWithItem(destinationPosX, destinationPosY, itemWidth, itemHeight, isRotated);
|
||||
|
||||
Assert.AreEqual(container[0, 0], 1);
|
||||
Assert.AreEqual(container[1, 0], 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FillContainerMapWithItem_2x2_at_0x0_in_2x2_no_rotation()
|
||||
{
|
||||
var container = new int[2, 2];
|
||||
|
||||
var itemWidth = 2;
|
||||
var itemHeight = 2;
|
||||
|
||||
var destinationPosX = 0;
|
||||
var destinationPosY = 0;
|
||||
var isRotated = false;
|
||||
|
||||
container.FillContainerMapWithItem(destinationPosX, destinationPosY, itemWidth, itemHeight, isRotated);
|
||||
|
||||
Assert.AreEqual(container[0, 0], 1);
|
||||
Assert.AreEqual(container[1, 1], 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FillContainerMapWithItem_1x2_at_0x0_in_2x2_with_rotation()
|
||||
{
|
||||
var container = new int[2, 2];
|
||||
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 2;
|
||||
|
||||
var destinationPosX = 0;
|
||||
var destinationPosY = 0;
|
||||
var isRotated = true;
|
||||
|
||||
container.FillContainerMapWithItem(destinationPosX, destinationPosY, itemWidth, itemHeight, isRotated);
|
||||
|
||||
Assert.AreEqual(container[0, 0], 1);
|
||||
Assert.AreEqual(container[0, 1], 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FillContainerMapWithItem_1x2_at_1x0_in_2x2_with_rotation_with_existing_item()
|
||||
{
|
||||
var container = new int[2, 2];
|
||||
container[0, 0] = 1;
|
||||
|
||||
var itemWidth = 1;
|
||||
var itemHeight = 2;
|
||||
|
||||
var destinationPosX = 0;
|
||||
var destinationPosY = 1;
|
||||
var isRotated = true;
|
||||
|
||||
container.FillContainerMapWithItem(destinationPosX, destinationPosY, itemWidth, itemHeight, isRotated);
|
||||
|
||||
Assert.AreEqual(container[1, 0], 1);
|
||||
Assert.AreEqual(container[1, 1], 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,327 @@
|
||||
using NUnit.Framework;
|
||||
using SPTarkov.Server.Core.Extensions;
|
||||
using SPTarkov.Server.Core.Models.Common;
|
||||
using SPTarkov.Server.Core.Models.Eft.Common;
|
||||
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
|
||||
|
||||
namespace UnitTests.Tests.Extensions;
|
||||
|
||||
[TestFixture]
|
||||
public class ItemTests
|
||||
{
|
||||
[SetUp]
|
||||
public void Initialize() { }
|
||||
|
||||
[Test]
|
||||
public void GetItemWithChildren_one_child_mods_only()
|
||||
{
|
||||
var testData = new List<Item>();
|
||||
var rootItem = new Item { Id = new MongoId(), Template = ItemTpl.AMMOBOX_127X33_COPPER_20RND };
|
||||
var childItem = new Item
|
||||
{
|
||||
Id = new MongoId(),
|
||||
Template = ItemTpl.AMMO_127X33_COPPER,
|
||||
ParentId = rootItem.Id,
|
||||
};
|
||||
testData.Add(rootItem);
|
||||
testData.Add(childItem);
|
||||
|
||||
var result = testData.GetItemWithChildren(rootItem.Id, true);
|
||||
|
||||
Assert.AreEqual(result[1].Id, childItem.Id);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetItemWithChildren_mods_only_one_inventory_item()
|
||||
{
|
||||
var testData = new List<Item>();
|
||||
var rootItem = new Item { Id = new MongoId(), Template = ItemTpl.AMMOBOX_127X33_COPPER_20RND };
|
||||
var childItem = new Item
|
||||
{
|
||||
Id = new MongoId(),
|
||||
Template = ItemTpl.AMMO_127X33_COPPER,
|
||||
ParentId = rootItem.Id,
|
||||
Location = 1,
|
||||
};
|
||||
var childItem2 = new Item
|
||||
{
|
||||
Id = new MongoId(),
|
||||
Template = ItemTpl.AMMO_26X75_GREEN,
|
||||
ParentId = rootItem.Id,
|
||||
};
|
||||
testData.Add(rootItem);
|
||||
testData.Add(childItem);
|
||||
testData.Add(childItem2);
|
||||
|
||||
var result = testData.GetItemWithChildren(rootItem.Id, true);
|
||||
|
||||
Assert.AreEqual(result[1].Id, childItem2.Id);
|
||||
Assert.AreEqual(result.Count, 2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetItemWithChildren_mods_and_inventory_item()
|
||||
{
|
||||
var testData = new List<Item>();
|
||||
var rootItem = new Item
|
||||
{
|
||||
Id = new MongoId(),
|
||||
Template = ItemTpl.AMMOBOX_127X33_COPPER_20RND,
|
||||
ParentId = new MongoId(),
|
||||
};
|
||||
var childItem = new Item
|
||||
{
|
||||
Id = new MongoId(),
|
||||
Template = ItemTpl.AMMO_127X33_COPPER,
|
||||
ParentId = rootItem.Id,
|
||||
Location = 1,
|
||||
};
|
||||
var childItem2 = new Item
|
||||
{
|
||||
Id = new MongoId(),
|
||||
Template = ItemTpl.AMMO_26X75_GREEN,
|
||||
ParentId = rootItem.Id,
|
||||
};
|
||||
testData.Add(rootItem);
|
||||
testData.Add(childItem);
|
||||
testData.Add(childItem2);
|
||||
|
||||
var result = testData.GetItemWithChildren(rootItem.Id, false);
|
||||
|
||||
Assert.Contains(childItem, result);
|
||||
Assert.Contains(childItem2, result);
|
||||
Assert.AreEqual(result.Count, 3);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetItemWithChildren_mod_with_child()
|
||||
{
|
||||
var testData = new List<Item>();
|
||||
var rootItem = new Item { Id = new MongoId(), Template = ItemTpl.AMMOBOX_127X33_COPPER_20RND };
|
||||
var childItem = new Item
|
||||
{
|
||||
Id = new MongoId(),
|
||||
Template = ItemTpl.AMMO_127X33_COPPER,
|
||||
ParentId = rootItem.Id,
|
||||
};
|
||||
var childOfChild = new Item
|
||||
{
|
||||
Id = new MongoId(),
|
||||
Template = ItemTpl.AMMO_26X75_GREEN,
|
||||
ParentId = childItem.Id,
|
||||
};
|
||||
testData.Add(rootItem);
|
||||
testData.Add(childItem);
|
||||
testData.Add(childOfChild);
|
||||
|
||||
var result = testData.GetItemWithChildren(rootItem.Id, true);
|
||||
|
||||
Assert.AreEqual(result[1].Id, childItem.Id);
|
||||
Assert.AreEqual(result.Count, 3);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetItemWithChildren_no_matching_children()
|
||||
{
|
||||
var testData = new List<Item>();
|
||||
var rootItem = new Item { Id = new MongoId(), Template = ItemTpl.AMMOBOX_127X33_COPPER_20RND };
|
||||
var childItem = new Item
|
||||
{
|
||||
Id = new MongoId(),
|
||||
Template = ItemTpl.AMMO_127X33_COPPER,
|
||||
ParentId = new MongoId(),
|
||||
};
|
||||
var childOfChild = new Item
|
||||
{
|
||||
Id = new MongoId(),
|
||||
Template = ItemTpl.AMMO_26X75_GREEN,
|
||||
ParentId = childItem.Id,
|
||||
};
|
||||
testData.Add(rootItem);
|
||||
testData.Add(childItem);
|
||||
testData.Add(childOfChild);
|
||||
|
||||
var result = testData.GetItemWithChildren(rootItem.Id, true);
|
||||
|
||||
Assert.AreEqual(result[0].Id, rootItem.Id);
|
||||
Assert.AreEqual(result.Count, 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RemoveFiRStatusFromItemsInContainer_twoItemsInBackpack()
|
||||
{
|
||||
var profile = new PmcData() { Inventory = new BotBaseInventory() { Items = [] } };
|
||||
profile.Inventory.Equipment = new MongoId();
|
||||
|
||||
// Add backpack
|
||||
var backpackId = new MongoId();
|
||||
profile.Inventory.Items.Add(
|
||||
new Item
|
||||
{
|
||||
Id = backpackId,
|
||||
Template = ItemTpl.BACKPACK_HAZARD_4_PILLBOX_BACKPACK_BLACK,
|
||||
ParentId = profile.Inventory.Equipment,
|
||||
SlotId = "Backpack",
|
||||
}
|
||||
);
|
||||
|
||||
// Add ifak to first slot in backpack
|
||||
var item1Id = new MongoId();
|
||||
profile.Inventory.Items.Add(
|
||||
new Item
|
||||
{
|
||||
Id = item1Id,
|
||||
Template = ItemTpl.MEDKIT_AFAK_TACTICAL_INDIVIDUAL_FIRST_AID_KIT,
|
||||
ParentId = backpackId,
|
||||
SlotId = "main",
|
||||
Upd = new Upd { SpawnedInSession = true },
|
||||
Location = new ItemLocation
|
||||
{
|
||||
X = 0,
|
||||
Y = 0,
|
||||
R = ItemRotation.Horizontal,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// Add wrench to first slot of ifak
|
||||
var item2Id = new MongoId();
|
||||
profile.Inventory.Items.Add(
|
||||
new Item
|
||||
{
|
||||
Id = item2Id,
|
||||
Template = ItemTpl.BARTER_WRENCH,
|
||||
ParentId = backpackId,
|
||||
SlotId = "main",
|
||||
Upd = new Upd { SpawnedInSession = true },
|
||||
Location = new ItemLocation
|
||||
{
|
||||
X = 1,
|
||||
Y = 0,
|
||||
R = ItemRotation.Horizontal,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// Add armband to armband slot as root
|
||||
var item3Id = new MongoId();
|
||||
profile.Inventory.Items.Add(
|
||||
new Item
|
||||
{
|
||||
Id = item3Id,
|
||||
Template = ItemTpl.ARMBAND_RED,
|
||||
ParentId = profile.Inventory.Equipment,
|
||||
SlotId = "Armband",
|
||||
Upd = new Upd { SpawnedInSession = true },
|
||||
}
|
||||
);
|
||||
|
||||
profile.RemoveFiRStatusFromItemsInContainer("Backpack");
|
||||
|
||||
Assert.AreEqual(false, profile.Inventory.Items.FirstOrDefault(item => item.Id == item1Id).Upd.SpawnedInSession);
|
||||
Assert.AreEqual(false, profile.Inventory.Items.FirstOrDefault(item => item.Id == item2Id).Upd.SpawnedInSession);
|
||||
Assert.AreEqual(true, profile.Inventory.Items.FirstOrDefault(item => item.Id == item3Id).Upd.SpawnedInSession);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RemoveFiRStatusFromItemsInContainer_oneItemWithChildInBackpack()
|
||||
{
|
||||
var profile = new PmcData { Inventory = new BotBaseInventory { Items = [] } };
|
||||
profile.Inventory.Equipment = new MongoId();
|
||||
|
||||
// Add backpack
|
||||
var backpackId = new MongoId();
|
||||
profile.Inventory.Items.Add(
|
||||
new Item
|
||||
{
|
||||
Id = backpackId,
|
||||
Template = ItemTpl.BACKPACK_HAZARD_4_PILLBOX_BACKPACK_BLACK,
|
||||
ParentId = profile.Inventory.Equipment,
|
||||
SlotId = "Backpack",
|
||||
}
|
||||
);
|
||||
|
||||
// Add ifak to first slot in backpack
|
||||
var item1Id = new MongoId();
|
||||
profile.Inventory.Items.Add(
|
||||
new Item
|
||||
{
|
||||
Id = item1Id,
|
||||
Template = ItemTpl.MEDKIT_AFAK_TACTICAL_INDIVIDUAL_FIRST_AID_KIT,
|
||||
ParentId = backpackId,
|
||||
SlotId = "main",
|
||||
Upd = new Upd { SpawnedInSession = true },
|
||||
Location = new ItemLocation
|
||||
{
|
||||
X = 0,
|
||||
Y = 0,
|
||||
R = ItemRotation.Horizontal,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// Add wrench to first slot of ifak as child
|
||||
var item2Id = new MongoId();
|
||||
profile.Inventory.Items.Add(
|
||||
new Item
|
||||
{
|
||||
Id = item2Id,
|
||||
Template = ItemTpl.BARTER_WRENCH,
|
||||
ParentId = item1Id,
|
||||
SlotId = "main",
|
||||
Upd = new Upd { SpawnedInSession = true },
|
||||
Location = new ItemLocation
|
||||
{
|
||||
X = 1,
|
||||
Y = 0,
|
||||
R = ItemRotation.Horizontal,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// Add armband to armband slot as root
|
||||
var item3Id = new MongoId();
|
||||
profile.Inventory.Items.Add(
|
||||
new Item
|
||||
{
|
||||
Id = item3Id,
|
||||
Template = ItemTpl.ARMBAND_RED,
|
||||
ParentId = profile.Inventory.Equipment,
|
||||
SlotId = "Armband",
|
||||
Upd = new Upd { SpawnedInSession = true },
|
||||
}
|
||||
);
|
||||
|
||||
profile.RemoveFiRStatusFromItemsInContainer("Backpack");
|
||||
|
||||
Assert.AreEqual(false, profile.Inventory.Items.FirstOrDefault(item => item.Id == item1Id).Upd.SpawnedInSession);
|
||||
Assert.AreEqual(false, profile.Inventory.Items.FirstOrDefault(item => item.Id == item2Id).Upd.SpawnedInSession);
|
||||
Assert.AreEqual(true, profile.Inventory.Items.FirstOrDefault(item => item.Id == item3Id).Upd.SpawnedInSession);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetItemWithChildren_rootIdNotFound()
|
||||
{
|
||||
var testData = new List<Item>();
|
||||
var rootItem = new Item { Id = new MongoId(), Template = ItemTpl.AMMOBOX_127X33_COPPER_20RND };
|
||||
var childItem = new Item
|
||||
{
|
||||
Id = new MongoId(),
|
||||
Template = ItemTpl.AMMO_127X33_COPPER,
|
||||
ParentId = rootItem.Id,
|
||||
};
|
||||
var childOfChild = new Item
|
||||
{
|
||||
Id = new MongoId(),
|
||||
Template = ItemTpl.AMMO_26X75_GREEN,
|
||||
ParentId = childItem.Id,
|
||||
};
|
||||
testData.Add(rootItem);
|
||||
testData.Add(childItem);
|
||||
testData.Add(childOfChild);
|
||||
|
||||
var result = testData.GetItemWithChildren(new MongoId(), true);
|
||||
|
||||
Assert.AreEqual(result.Count, 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user