Started work on Item Filter Preview module
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{58CD3B9C-EBBA-4527-A81C-78B7EA9CA298}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Filtration.ItemFilterPreview.Tests</RootNamespace>
|
||||
<AssemblyName>Filtration.ItemFilterPreview.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<TargetPlatformVersion>8.1</TargetPlatformVersion>
|
||||
<MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>True</IsCodedUITest>
|
||||
<TestProjectType>CodedUITest</TestProjectType>
|
||||
<IsWindowsStoreCodedUITest>True</IsWindowsStoreCodedUITest>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Moq, Version=4.2.1510.2205, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=3.0.5813.39031, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.3.0.1\lib\net45\nunit.framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
|
||||
<Visible>False</Visible>
|
||||
</CodeAnalysisDependentAssemblyPaths>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\TestItemBlockItemMatcher.cs" />
|
||||
<Compile Include="Services\TestItemFilterProcessor.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Filtration.ItemFilterPreview\Filtration.ItemFilterPreview.csproj">
|
||||
<Project>{3ab98b6e-05db-44fa-9dad-584aa88f0739}</Project>
|
||||
<Name>Filtration.ItemFilterPreview</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
||||
<Name>Filtration.ObjectModel</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Filtration.ItemFilterPreview.Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Filtration.ItemFilterPreview.Tests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("58cd3b9c-ebba-4527-a81c-78b7ea9ca298")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Filtration.ItemFilterPreview.Model;
|
||||
using Filtration.ItemFilterPreview.Services;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.ItemFilterPreview.Tests.Services
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestItemBlockItemMatcher
|
||||
{
|
||||
private ItemBlockItemMatcherTestUtility _testUtility;
|
||||
|
||||
[SetUp]
|
||||
public void ItemBlockItemMatcherTestSetUp()
|
||||
{
|
||||
_testUtility = new ItemBlockItemMatcherTestUtility();
|
||||
}
|
||||
|
||||
[TestCase("Test Base Type", true)]
|
||||
[TestCase("Test Bas", true)]
|
||||
[TestCase("T", true)]
|
||||
[TestCase("Base Type", false)]
|
||||
public void BaseTypeBlockItemMatch_SingleBlockItemValue_ReturnsTrue(string testInputBaseType, bool expectedResult)
|
||||
{
|
||||
//Arrange
|
||||
var testInputItem = Mock.Of<IItem>(i => i.BaseType == "Test Base Type");
|
||||
var testInputBaseTypeBlockItem = new BaseTypeBlockItem();
|
||||
testInputBaseTypeBlockItem.Items.Add(testInputBaseType);
|
||||
|
||||
//Act
|
||||
var result = _testUtility.ItemBlockItemMatcher.BaseTypeBlockItemMatch(testInputBaseTypeBlockItem, testInputItem);
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[TestCase("Test Base Type", true)]
|
||||
[TestCase("Test Bas", true)]
|
||||
[TestCase("T", true)]
|
||||
[TestCase("Base Type", false)]
|
||||
public void BaseTypeBlockItemMatch_MultipleBlockItemValues_ReturnsCorrectResult(string testInputBaseType, bool expectedResult)
|
||||
{
|
||||
//Arrange
|
||||
var testInputItem = Mock.Of<IItem>(i => i.BaseType == "Test Base Type");
|
||||
var testInputBlockItem = new BaseTypeBlockItem();
|
||||
testInputBlockItem.Items.Add("Something else");
|
||||
testInputBlockItem.Items.Add(testInputBaseType);
|
||||
testInputBlockItem.Items.Add("Blah");
|
||||
|
||||
//Act
|
||||
var result = _testUtility.ItemBlockItemMatcher.BaseTypeBlockItemMatch(testInputBlockItem, testInputItem);
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[TestCase("Test Item Class", true)]
|
||||
[TestCase("Test It", true)]
|
||||
[TestCase("T", true)]
|
||||
[TestCase("Item Class", false)]
|
||||
public void ItemClassBlockItemMatch_SingleBlockItemValue_ReturnsCorrectResult(string testInputBlockItemItemClass, bool expectedResult)
|
||||
{
|
||||
//Arrange
|
||||
var testInputItem = Mock.Of<IItem>(i => i.ItemClass == "Test Item Class");
|
||||
var testInputBlockItem = new ClassBlockItem();
|
||||
testInputBlockItem.Items.Add(testInputBlockItemItemClass);
|
||||
|
||||
//Act
|
||||
var result = _testUtility.ItemBlockItemMatcher.ClassBlockItemMatch(testInputBlockItem, testInputItem);
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
[TestCase(FilterPredicateOperator.Equal, 49, false)]
|
||||
[TestCase(FilterPredicateOperator.Equal, 50, true)]
|
||||
[TestCase(FilterPredicateOperator.Equal, 51, false)]
|
||||
[TestCase(FilterPredicateOperator.GreaterThan, 49, true)]
|
||||
[TestCase(FilterPredicateOperator.GreaterThan, 50, false)]
|
||||
[TestCase(FilterPredicateOperator.GreaterThan, 51, false)]
|
||||
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 49, true)]
|
||||
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 50, true)]
|
||||
[TestCase(FilterPredicateOperator.GreaterThanOrEqual, 51, false)]
|
||||
[TestCase(FilterPredicateOperator.LessThan, 49, false)]
|
||||
[TestCase(FilterPredicateOperator.LessThan, 50, false)]
|
||||
[TestCase(FilterPredicateOperator.LessThan, 51, true)]
|
||||
[TestCase(FilterPredicateOperator.LessThanOrEqual, 49, false)]
|
||||
[TestCase(FilterPredicateOperator.LessThanOrEqual, 50, true)]
|
||||
[TestCase(FilterPredicateOperator.LessThanOrEqual, 51, true)]
|
||||
[TestCase(-1, 51, false)]
|
||||
public void DropLevelBlockItemMatch_ReturnsCorrectResult(FilterPredicateOperator testInputFilterPredicateOperator, int testInputBlockItemDropLevel, bool expectedResult)
|
||||
{
|
||||
//Arrange
|
||||
var testInputItem = Mock.Of<IItem>(i => i.DropLevel == 50);
|
||||
var testInputBlockItem = new DropLevelBlockItem(testInputFilterPredicateOperator, testInputBlockItemDropLevel);
|
||||
|
||||
//Act
|
||||
var result = _testUtility.ItemBlockItemMatcher.DropLevelBlockItemMatch(testInputBlockItem, testInputItem);
|
||||
|
||||
//Assert
|
||||
Assert.AreEqual(expectedResult, result);
|
||||
}
|
||||
|
||||
|
||||
private class ItemBlockItemMatcherTestUtility
|
||||
{
|
||||
public ItemBlockItemMatcherTestUtility()
|
||||
{
|
||||
// Mock setups
|
||||
|
||||
// Class under-test instantiation
|
||||
ItemBlockItemMatcher = new ItemBlockItemMatcher();
|
||||
}
|
||||
|
||||
public ItemBlockItemMatcher ItemBlockItemMatcher { get; private set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.ItemFilterPreview.Tests.Services
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestItemFilterProcessor
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
5
Filtration.ItemFilterPreview.Tests/packages.config
Normal file
5
Filtration.ItemFilterPreview.Tests/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Moq" version="4.2.1510.2205" targetFramework="net46" />
|
||||
<package id="NUnit" version="3.0.1" targetFramework="net46" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user