Initial item filter / loot item processing done
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemBaseTypes;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.ObjectModel.Tests.BlockItemBaseTypes
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestBaseTypeBlockItem
|
||||
{
|
||||
[Test]
|
||||
public void MatchesBlockItem_BlankLootItem_ReturnsFalse()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var blockItem = new BaseTypeBlockItem();
|
||||
var testInputLootItem = new LootItem();
|
||||
|
||||
// Act
|
||||
var result = blockItem.MatchesLootItem(testInputLootItem);
|
||||
|
||||
// Assert
|
||||
Assert.IsFalse(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MatchesBlockItem_StringMatch_ReturnsTrue()
|
||||
{
|
||||
// Arrange
|
||||
var testInputBaseType = "Test Base Type";
|
||||
|
||||
var blockItem = new BaseTypeBlockItem();
|
||||
blockItem.Items.Add("Testblah");
|
||||
blockItem.Items.Add(testInputBaseType);
|
||||
blockItem.Items.Add("Another Base Type");
|
||||
|
||||
var testInputLootItem = new LootItem { BaseType = testInputBaseType};
|
||||
|
||||
// Act
|
||||
var result = blockItem.MatchesLootItem(testInputLootItem);
|
||||
|
||||
// Assert
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.ObjectModel.Tests.BlockItemBaseTypes
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestClassBlockItem
|
||||
{
|
||||
[Test]
|
||||
public void MatchesBlockItem_BlankLootItem_ReturnsFalse()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var blockItem = new ClassBlockItem();
|
||||
var testInputLootItem = new LootItem();
|
||||
|
||||
// Act
|
||||
var result = blockItem.MatchesLootItem(testInputLootItem);
|
||||
|
||||
// Assert
|
||||
Assert.IsFalse(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MatchesBlockItem_StringMatch_ReturnsTrue()
|
||||
{
|
||||
// Arrange
|
||||
var testInputClass = "Test Class";
|
||||
|
||||
var blockItem = new ClassBlockItem();
|
||||
blockItem.Items.Add("Testblah");
|
||||
blockItem.Items.Add(testInputClass);
|
||||
blockItem.Items.Add("Another Base Type");
|
||||
|
||||
var testInputLootItem = new LootItem { Class = testInputClass };
|
||||
|
||||
// Act
|
||||
var result = blockItem.MatchesLootItem(testInputLootItem);
|
||||
|
||||
// Assert
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.ObjectModel.Tests.BlockItemBaseTypes
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestItemLevelBlockItem
|
||||
{
|
||||
[Test]
|
||||
public void MatchesBlockItem_NoMatch_ReturnsFalse()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var blockItem = new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 10);
|
||||
var lootItem = new LootItem {ItemLevel = 5};
|
||||
|
||||
// Act
|
||||
var result = blockItem.MatchesLootItem(lootItem);
|
||||
|
||||
// Assert
|
||||
Assert.IsFalse(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MatchesBlockItem_EqualsMatch_ReturnsTrue()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var blockItem = new ItemLevelBlockItem(FilterPredicateOperator.Equal, 10);
|
||||
var lootItem = new LootItem { ItemLevel = 10 };
|
||||
|
||||
// Act
|
||||
var result = blockItem.MatchesLootItem(lootItem);
|
||||
|
||||
// Assert
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MatchesBlockItem_GreaterThanMatch_ReturnsTrue()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var blockItem = new ItemLevelBlockItem(FilterPredicateOperator.GreaterThan, 10);
|
||||
var lootItem = new LootItem { ItemLevel = 50 };
|
||||
|
||||
// Act
|
||||
var result = blockItem.MatchesLootItem(lootItem);
|
||||
|
||||
// Assert
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MatchesBlockItem_GreaterThanOrEqualMatch_ReturnsTrue()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var blockItem = new ItemLevelBlockItem(FilterPredicateOperator.GreaterThanOrEqual, 10);
|
||||
var lootItem = new LootItem { ItemLevel = 50 };
|
||||
|
||||
// Act
|
||||
var result = blockItem.MatchesLootItem(lootItem);
|
||||
|
||||
// Assert
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MatchesBlockItem_LessThan_ReturnsTrue()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var blockItem = new ItemLevelBlockItem(FilterPredicateOperator.LessThan, 10);
|
||||
var lootItem = new LootItem { ItemLevel = 1 };
|
||||
|
||||
// Act
|
||||
var result = blockItem.MatchesLootItem(lootItem);
|
||||
|
||||
// Assert
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MatchesBlockItem_LessThanOrEqual_ReturnsTrue()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var blockItem = new ItemLevelBlockItem(FilterPredicateOperator.LessThanOrEqual, 10);
|
||||
var lootItem = new LootItem { ItemLevel = 1 };
|
||||
|
||||
// Act
|
||||
var result = blockItem.MatchesLootItem(lootItem);
|
||||
|
||||
// Assert
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Sockets;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.LootExplosionStudio;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.ObjectModel.Tests.BlockItemBaseTypes
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSocketGroupBlockItem
|
||||
{
|
||||
[Test]
|
||||
public void MatchesBlockItem_BlankLootItem_ReturnsFalse()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var blockItem = new SocketGroupBlockItem();
|
||||
var testInputLootItem = new LootItem();
|
||||
|
||||
// Act
|
||||
var result = blockItem.MatchesLootItem(testInputLootItem);
|
||||
|
||||
// Assert
|
||||
Assert.IsFalse(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MatchesBlockItem_SocketsMatch_ReturnsTrue()
|
||||
{
|
||||
// Arrange
|
||||
var testInputSocketGroups = new List<SocketGroup>();
|
||||
var testInputSocketGroup1 = new SocketGroup();
|
||||
var testInputSocketGroup2 = new SocketGroup();
|
||||
testInputSocketGroup1.Sockets = new List<SocketColor> {SocketColor.Blue, SocketColor.Red};
|
||||
testInputSocketGroup2.Sockets = new List<SocketColor>
|
||||
{
|
||||
SocketColor.Blue,
|
||||
SocketColor.Blue,
|
||||
SocketColor.Blue,
|
||||
SocketColor.Red
|
||||
};
|
||||
|
||||
testInputSocketGroups.Add(testInputSocketGroup1);
|
||||
testInputSocketGroups.Add(testInputSocketGroup2);
|
||||
|
||||
var blockItem = new SocketGroupBlockItem();
|
||||
blockItem.Items.Add("RRG");
|
||||
blockItem.Items.Add("BRB");
|
||||
|
||||
var testInputLootItem = new LootItem {SocketGroups = testInputSocketGroups};
|
||||
|
||||
// Act
|
||||
var result = blockItem.MatchesLootItem(testInputLootItem);
|
||||
|
||||
// Assert
|
||||
Assert.IsTrue(result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MatchesBlockItem_SocketsAlmostMatch_ReturnsFalse()
|
||||
{
|
||||
// Arrange
|
||||
var testInputSocketGroups = new List<SocketGroup>();
|
||||
var testInputSocketGroup1 = new SocketGroup();
|
||||
var testInputSocketGroup2 = new SocketGroup();
|
||||
testInputSocketGroup1.Sockets = new List<SocketColor> { SocketColor.Blue, SocketColor.Red };
|
||||
testInputSocketGroup2.Sockets = new List<SocketColor>
|
||||
{
|
||||
SocketColor.Blue,
|
||||
SocketColor.Blue,
|
||||
SocketColor.Blue,
|
||||
SocketColor.Red,
|
||||
SocketColor.Green
|
||||
};
|
||||
|
||||
testInputSocketGroups.Add(testInputSocketGroup1);
|
||||
testInputSocketGroups.Add(testInputSocketGroup2);
|
||||
|
||||
var blockItem = new SocketGroupBlockItem();
|
||||
blockItem.Items.Add("BGBRWB");
|
||||
|
||||
var testInputLootItem = new LootItem { SocketGroups = testInputSocketGroups };
|
||||
|
||||
// Act
|
||||
var result = blockItem.MatchesLootItem(testInputLootItem);
|
||||
|
||||
// Assert
|
||||
Assert.IsFalse(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,10 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BlockItemBaseTypes\TestBaseTypeBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\TestClassBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\TestItemLevelBlockItem.cs" />
|
||||
<Compile Include="BlockItemBaseTypes\TestSocketGroupBlockItem.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TestItemFilterBlock.cs" />
|
||||
<Compile Include="TestItemFilterBlockGroup.cs" />
|
||||
|
||||
Reference in New Issue
Block a user