diff --git a/Projects/UOContent.Tests/Tests/PropertyList/AosArmorAttributesPropertiesTests.cs b/Projects/UOContent.Tests/Tests/PropertyList/AosArmorAttributesPropertiesTests.cs deleted file mode 100644 index 28feedbea..000000000 --- a/Projects/UOContent.Tests/Tests/PropertyList/AosArmorAttributesPropertiesTests.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Buffers.Binary; -using System.Collections.Generic; -using System.Text; -using Server; -using Server.Items; -using Xunit; - -namespace UOContent.Tests; - -[Collection("Sequential UOContent Tests")] -public class AosArmorAttributesPropertiesTests -{ - private static Dictionary Decode(ObjectPropertyList opl) - { - opl.Terminate(); - var buffer = opl.Buffer; - var map = new Dictionary(); - var pos = 15; - while (true) - { - var cliloc = BinaryPrimitives.ReadInt32BigEndian(buffer.AsSpan(pos)); - pos += 4; - if (cliloc == 0) - { - break; - } - - var byteLen = BinaryPrimitives.ReadUInt16BigEndian(buffer.AsSpan(pos)); - pos += 2; - map[cliloc] = Encoding.Unicode.GetString(buffer, pos, byteLen); - pos += byteLen; - } - - return map; - } - - [Fact] - public void EmitsMageArmorAndSelfRepair_DoesNotReadLowerStatReqOrDurabilityFromContainer() - { - var attrs = new AosArmorAttributes(null) - { - MageArmor = 1, - SelfRepair = 4, - LowerStatReq = 50, // container value must NOT be auto-emitted (it's passed in by the consumer) - DurabilityBonus = 10 // never emitted by this method - }; - - var opl = new ObjectPropertyList(null); - attrs.GetProperties(opl); // no lowerStatReq arg - var map = Decode(opl); - - Assert.Equal("", map[1060437]); // MageArmor (no-arg) - Assert.Equal("4", map[1060450]); // SelfRepair - Assert.False(map.ContainsKey(1060435)); // LowerStatReq NOT read from container - Assert.False(map.ContainsKey(1060410)); // DurabilityBonus excluded - } -} diff --git a/Projects/UOContent.Tests/Tests/PropertyList/AosAttributesPropertiesTests.cs b/Projects/UOContent.Tests/Tests/PropertyList/AosAttributesPropertiesTests.cs deleted file mode 100644 index 6571c1312..000000000 --- a/Projects/UOContent.Tests/Tests/PropertyList/AosAttributesPropertiesTests.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Buffers.Binary; -using System.Collections.Generic; -using System.Text; -using Server; -using Server.Items; -using Xunit; - -namespace UOContent.Tests; - -[Collection("Sequential UOContent Tests")] -public class AosAttributesPropertiesTests -{ - private static Dictionary Decode(ObjectPropertyList opl) - { - opl.Terminate(); - var buffer = opl.Buffer; - var map = new Dictionary(); - var pos = 15; - while (true) - { - var cliloc = BinaryPrimitives.ReadInt32BigEndian(buffer.AsSpan(pos)); - pos += 4; - if (cliloc == 0) - { - break; - } - - var byteLen = BinaryPrimitives.ReadUInt16BigEndian(buffer.AsSpan(pos)); - pos += 2; - map[cliloc] = Encoding.Unicode.GetString(buffer, pos, byteLen); - pos += byteLen; - } - - return map; - } - - [Fact] - public void EmitsRawAttributesInCanonicalOrder() - { - var attrs = new AosAttributes(null) - { - DefendChance = 5, - BonusStr = 10, - NightSight = 1, - SpellChanneling = 1, - WeaponSpeed = 7 - }; - - var opl = new ObjectPropertyList(null); - attrs.GetProperties(opl); - var map = Decode(opl); - - Assert.Equal("5", map[1060408]); // DefendChance - Assert.Equal("10", map[1060485]); // BonusStr - Assert.Equal("", map[1060441]); // NightSight (no-arg) - Assert.Equal("", map[1060482]); // SpellChanneling (no-arg) - Assert.Equal("7", map[1060486]); // WeaponSpeed - Assert.False(map.ContainsKey(1060401)); // WeaponDamage not set - } - - [Fact] - public void AppliesComputedBonuses() - { - var attrs = new AosAttributes(null) { WeaponDamage = 10, AttackChance = 4, Luck = 100 }; - - var opl = new ObjectPropertyList(null); - attrs.GetProperties(opl, damageBonus: 5, hitChanceBonus: 3, luckBonus: 50); - var map = Decode(opl); - - Assert.Equal("15", map[1060401]); // WeaponDamage + damageBonus - Assert.Equal("7", map[1060415]); // AttackChance + hitChanceBonus - Assert.Equal("150", map[1060436]); // Luck + luckBonus - } -} diff --git a/Projects/UOContent.Tests/Tests/PropertyList/AosWeaponAttributesPropertiesTests.cs b/Projects/UOContent.Tests/Tests/PropertyList/AosWeaponAttributesPropertiesTests.cs deleted file mode 100644 index ddec86fe9..000000000 --- a/Projects/UOContent.Tests/Tests/PropertyList/AosWeaponAttributesPropertiesTests.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Buffers.Binary; -using System.Collections.Generic; -using System.Text; -using Server; -using Server.Items; -using Xunit; - -namespace UOContent.Tests; - -[Collection("Sequential UOContent Tests")] -public class AosWeaponAttributesPropertiesTests -{ - private static Dictionary Decode(ObjectPropertyList opl) - { - opl.Terminate(); - var buffer = opl.Buffer; - var map = new Dictionary(); - var pos = 15; - while (true) - { - var cliloc = BinaryPrimitives.ReadInt32BigEndian(buffer.AsSpan(pos)); - pos += 4; - if (cliloc == 0) - { - break; - } - - var byteLen = BinaryPrimitives.ReadUInt16BigEndian(buffer.AsSpan(pos)); - pos += 2; - map[cliloc] = Encoding.Unicode.GetString(buffer, pos, byteLen); - pos += byteLen; - } - - return map; - } - - [Fact] - public void EmitsHitEffectsUseBestSkillMageWeaponSelfRepair() - { - var attrs = new AosWeaponAttributes(null) - { - UseBestSkill = 1, - HitFireball = 12, - HitLeechHits = 20, - MageWeapon = 25, - SelfRepair = 3 - }; - - var opl = new ObjectPropertyList(null); - attrs.GetProperties(opl); - var map = Decode(opl); - - Assert.Equal("", map[1060400]); // UseBestSkill (no-arg) - Assert.Equal("12", map[1060420]); // HitFireball - Assert.Equal("20", map[1060422]); // HitLeechHits - Assert.Equal("5", map[1060438]); // MageWeapon => 30 - 25 - Assert.Equal("3", map[1060450]); // SelfRepair - Assert.False(map.ContainsKey(1060435)); // LowerStatReq is emitted inline by the weapon, not by GetProperties - } -} diff --git a/Projects/UOContent.Tests/Tests/PropertyList/BaseArmorPropertiesTests.cs b/Projects/UOContent.Tests/Tests/PropertyList/BaseArmorPropertiesTests.cs deleted file mode 100644 index 5176e6db6..000000000 --- a/Projects/UOContent.Tests/Tests/PropertyList/BaseArmorPropertiesTests.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Server.Items; -using Xunit; - -namespace UOContent.Tests; - -[Collection("Sequential UOContent Tests")] -public class BaseArmorPropertiesTests -{ - [Fact] - public void Armor_AttributeLineSet_Preserved() - { - var armor = new PlateChest(); - try - { - armor.Attributes.DefendChance = 5; - armor.Attributes.BonusDex = 8; - armor.Attributes.Luck = 40; - armor.Attributes.SpellChanneling = 1; - armor.Attributes.IncreasedKarmaLoss = 2; - armor.ArmorAttributes.MageArmor = 1; - armor.ArmorAttributes.SelfRepair = 3; - armor.ArmorAttributes.LowerStatReq = 50; - - var map = ItemOplTestHelper.DecodeAttributeLines(armor); - - Assert.Equal("5", map[1060408]); // DefendChance - Assert.Equal("8", map[1060409]); // BonusDex - Assert.Equal("40", map[1060436]); // Luck (GetLuckBonus()==0 unequipped) - Assert.Equal("", map[1060482]); // SpellChanneling - Assert.Equal("2", map[1075210]); // IncreasedKarmaLoss - Assert.Equal("", map[1060437]); // MageArmor - Assert.Equal("3", map[1060450]); // SelfRepair - Assert.Equal("50", map[1060435]); // LowerStatReq (inline via GetLowerStatReq) - } - finally - { - armor.Delete(); - } - } -} diff --git a/Projects/UOContent.Tests/Tests/PropertyList/BaseClothingPropertiesTests.cs b/Projects/UOContent.Tests/Tests/PropertyList/BaseClothingPropertiesTests.cs deleted file mode 100644 index d7d51c3f3..000000000 --- a/Projects/UOContent.Tests/Tests/PropertyList/BaseClothingPropertiesTests.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Server.Items; -using Xunit; - -namespace UOContent.Tests; - -[Collection("Sequential UOContent Tests")] -public class BaseClothingPropertiesTests -{ - [Fact] - public void Clothing_AttributeLineSet_Preserved() - { - var shirt = new FancyShirt(); - try - { - shirt.Attributes.DefendChance = 5; - shirt.Attributes.Luck = 25; - shirt.Attributes.SpellChanneling = 1; - shirt.ClothingAttributes.MageArmor = 1; - shirt.ClothingAttributes.SelfRepair = 2; - shirt.ClothingAttributes.LowerStatReq = 30; - shirt.ClothingAttributes.DurabilityBonus = 15; - - var map = ItemOplTestHelper.DecodeAttributeLines(shirt); - - Assert.Equal("5", map[1060408]); // DefendChance - Assert.Equal("25", map[1060436]); // Luck (raw) - Assert.Equal("", map[1060482]); // SpellChanneling - Assert.Equal("", map[1060437]); // MageArmor - Assert.Equal("2", map[1060450]); // SelfRepair - Assert.Equal("30", map[1060435]); // LowerStatReq (direct) - Assert.Equal("15", map[1060410]); // DurabilityBonus (direct) - } - finally - { - shirt.Delete(); - } - } -} diff --git a/Projects/UOContent.Tests/Tests/PropertyList/BaseJewelPropertiesTests.cs b/Projects/UOContent.Tests/Tests/PropertyList/BaseJewelPropertiesTests.cs deleted file mode 100644 index 30acb6cf1..000000000 --- a/Projects/UOContent.Tests/Tests/PropertyList/BaseJewelPropertiesTests.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Server.Items; -using Xunit; - -namespace UOContent.Tests; - -[Collection("Sequential UOContent Tests")] -public class BaseJewelPropertiesTests -{ - [Fact] - public void Jewel_AttributeLineSet_Preserved() - { - var ring = new GoldRing(); - try - { - ring.Attributes.DefendChance = 5; - ring.Attributes.BonusStr = 10; - ring.Attributes.Luck = 100; - ring.Attributes.NightSight = 1; - ring.Attributes.SpellChanneling = 1; - ring.Attributes.IncreasedKarmaLoss = 3; - - var map = ItemOplTestHelper.DecodeAttributeLines(ring); - - Assert.Equal("5", map[1060408]); // DefendChance - Assert.Equal("10", map[1060485]); // BonusStr - Assert.Equal("100", map[1060436]); // Luck (raw; jewel has no luck bonus) - Assert.Equal("", map[1060441]); // NightSight - Assert.Equal("", map[1060482]); // SpellChanneling - Assert.Equal("3", map[1075210]); // IncreasedKarmaLoss (Core.ML EJ) - } - finally - { - ring.Delete(); - } - } -} diff --git a/Projects/UOContent.Tests/Tests/PropertyList/BaseTalismanPropertiesTests.cs b/Projects/UOContent.Tests/Tests/PropertyList/BaseTalismanPropertiesTests.cs deleted file mode 100644 index d42684658..000000000 --- a/Projects/UOContent.Tests/Tests/PropertyList/BaseTalismanPropertiesTests.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Server.Items; -using Xunit; - -namespace UOContent.Tests; - -[Collection("Sequential UOContent Tests")] -public class BaseTalismanPropertiesTests -{ - [Fact] - public void GetProperties_EmitsAosAttributeLines() - { - var item = new RandomTalisman(); - try - { - item.Attributes.DefendChance = 10; - item.Attributes.BonusStr = 5; - item.Attributes.Luck = 50; - item.Attributes.NightSight = 1; - item.Attributes.SpellChanneling = 1; - item.Attributes.IncreasedKarmaLoss = 2; - - var lines = ItemOplTestHelper.DecodeAttributeLines(item); - - Assert.True(lines.ContainsKey(1060408)); // DefendChance - Assert.Equal("10", lines[1060408]); - Assert.True(lines.ContainsKey(1060485)); // BonusStr - Assert.Equal("5", lines[1060485]); - Assert.True(lines.ContainsKey(1060436)); // Luck - Assert.Equal("50", lines[1060436]); - Assert.True(lines.ContainsKey(1060441)); // NightSight - Assert.Equal("", lines[1060441]); - Assert.True(lines.ContainsKey(1060482)); // SpellChanneling - Assert.Equal("", lines[1060482]); - Assert.True(lines.ContainsKey(1075210)); // IncreasedKarmaLoss - Assert.Equal("2", lines[1075210]); - } - finally - { - item.Delete(); - } - } -} diff --git a/Projects/UOContent.Tests/Tests/PropertyList/BaseWeaponPropertiesTests.cs b/Projects/UOContent.Tests/Tests/PropertyList/BaseWeaponPropertiesTests.cs deleted file mode 100644 index 213e59cb9..000000000 --- a/Projects/UOContent.Tests/Tests/PropertyList/BaseWeaponPropertiesTests.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Server.Items; -using Xunit; - -namespace UOContent.Tests; - -[Collection("Sequential UOContent Tests")] -public class BaseWeaponPropertiesTests -{ - [Fact] - public void Weapon_AttributeLineSet_Preserved() - { - var weapon = new Longsword(); - try - { - weapon.Attributes.DefendChance = 5; - weapon.Attributes.BonusInt = 6; - weapon.Attributes.SpellChanneling = 1; - weapon.WeaponAttributes.UseBestSkill = 1; - weapon.WeaponAttributes.HitFireball = 12; - weapon.WeaponAttributes.MageWeapon = 25; - weapon.WeaponAttributes.SelfRepair = 3; - - var map = ItemOplTestHelper.DecodeAttributeLines(weapon); - - Assert.Equal("5", map[1060408]); // DefendChance - Assert.Equal("6", map[1060432]); // BonusInt - Assert.Equal("", map[1060482]); // SpellChanneling - Assert.Equal("", map[1060400]); // UseBestSkill - Assert.Equal("12", map[1060420]); // HitFireball - Assert.Equal("5", map[1060438]); // MageWeapon (30 - 25) - Assert.Equal("3", map[1060450]); // SelfRepair - } - finally - { - weapon.Delete(); - } - } -} diff --git a/Projects/UOContent.Tests/Tests/PropertyList/ItemOplTestHelper.cs b/Projects/UOContent.Tests/Tests/PropertyList/ItemOplTestHelper.cs deleted file mode 100644 index 1b4acf26b..000000000 --- a/Projects/UOContent.Tests/Tests/PropertyList/ItemOplTestHelper.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Buffers.Binary; -using System.Collections.Generic; -using System.Text; -using Server; - -namespace UOContent.Tests; - -public static class ItemOplTestHelper -{ - // Builds the item's OPL and returns attribute/property cliloc lines (>= 1060000), - // ignoring base-item lines (name, weight, etc.) so tests isolate the attribute surface. - public static Dictionary DecodeAttributeLines(Item item) - { - var opl = new ObjectPropertyList(item); - item.GetProperties(opl); - opl.Terminate(); - - var buffer = opl.Buffer; - var map = new Dictionary(); - var pos = 15; - while (true) - { - var cliloc = BinaryPrimitives.ReadInt32BigEndian(buffer.AsSpan(pos)); - pos += 4; - if (cliloc == 0) - { - break; - } - - var byteLen = BinaryPrimitives.ReadUInt16BigEndian(buffer.AsSpan(pos)); - pos += 2; - var arg = Encoding.Unicode.GetString(buffer, pos, byteLen); - pos += byteLen; - - if (cliloc is >= 1060000 and < 1080000) - { - map[cliloc] = arg; - } - } - - return map; - } -} diff --git a/Projects/UOContent.Tests/Tests/PropertyList/SpellbookPropertiesTests.cs b/Projects/UOContent.Tests/Tests/PropertyList/SpellbookPropertiesTests.cs deleted file mode 100644 index 4f14d1f71..000000000 --- a/Projects/UOContent.Tests/Tests/PropertyList/SpellbookPropertiesTests.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Server.Items; -using Xunit; - -namespace UOContent.Tests; - -[Collection("Sequential UOContent Tests")] -public class SpellbookPropertiesTests -{ - [Fact] - public void GetProperties_EmitsAosAttributeLines() - { - var item = new Spellbook(); - try - { - item.Attributes.CastRecovery = 3; - item.Attributes.LowerManaCost = 8; - item.Attributes.Luck = 75; - item.Attributes.NightSight = 1; - item.Attributes.SpellChanneling = 1; - item.Attributes.IncreasedKarmaLoss = 2; - - var lines = ItemOplTestHelper.DecodeAttributeLines(item); - - Assert.True(lines.ContainsKey(1060412)); // CastRecovery - Assert.Equal("3", lines[1060412]); - Assert.True(lines.ContainsKey(1060433)); // LowerManaCost - Assert.Equal("8", lines[1060433]); - Assert.True(lines.ContainsKey(1060436)); // Luck - Assert.Equal("75", lines[1060436]); - Assert.True(lines.ContainsKey(1060441)); // NightSight - Assert.Equal("", lines[1060441]); - Assert.True(lines.ContainsKey(1060482)); // SpellChanneling - Assert.Equal("", lines[1060482]); - Assert.True(lines.ContainsKey(1075210)); // IncreasedKarmaLoss - Assert.Equal("2", lines[1075210]); - } - finally - { - item.Delete(); - } - } -}