Added untracked files
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{450AC313-BF25-4BFD-A066-9F39F026FDCF}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Filtration.ThemeEditor.Tests</RootNamespace>
|
||||
<AssemblyName>Filtration.ThemeEditor.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</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">
|
||||
<HintPath>..\packages\Moq.4.2.1506.2515\lib\net40\Moq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Models\TestTheme.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Providers\TestThemeProvider.cs" />
|
||||
<Compile Include="Services\TestThemeService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Filtration.ObjectModel\Filtration.ObjectModel.csproj">
|
||||
<Project>{4aac3beb-1dc1-483e-9d11-0e9334e80227}</Project>
|
||||
<Name>Filtration.ObjectModel</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Filtration.ThemeEditor\Filtration.ThemeEditor.csproj">
|
||||
<Project>{41b8f5c2-65aa-42f0-a20b-6f95b13a9f48}</Project>
|
||||
<Name>Filtration.ThemeEditor</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\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>
|
||||
78
Filtration.ThemeEditor.Tests/Models/TestTheme.cs
Normal file
78
Filtration.ThemeEditor.Tests/Models/TestTheme.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.ThemeEditor.Tests.Models
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestTheme
|
||||
{
|
||||
[Test]
|
||||
public void ComponentExists_ComponentDoesExist_ReturnsTrue()
|
||||
{
|
||||
// Arrange
|
||||
var theme = new Theme();
|
||||
|
||||
var testInputComponentTargetType = ThemeComponentType.TextColor;
|
||||
const string TestInputComponentName = "test";
|
||||
|
||||
theme.AddComponent(testInputComponentTargetType, TestInputComponentName, new Color());
|
||||
|
||||
// Act
|
||||
var result = theme.ComponentExists(testInputComponentTargetType, TestInputComponentName);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(true, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ComponentExists_ComponentDoesNotExist_DifferentNameSameType_ReturnsFalse()
|
||||
{
|
||||
// Arrange
|
||||
var theme = new Theme();
|
||||
|
||||
var testInputComponentTargetType = ThemeComponentType.TextColor;
|
||||
const string TestInputComponentName = "test";
|
||||
theme.AddComponent(testInputComponentTargetType, TestInputComponentName, new Color());
|
||||
|
||||
// Act
|
||||
var result = theme.ComponentExists(testInputComponentTargetType, "blah");
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(false, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ComponentExists_ComponentDoesNotExist_DifferentTypeSameName_ReturnsFalse()
|
||||
{
|
||||
// Arrange
|
||||
var theme = new Theme();
|
||||
|
||||
var testInputComponentTargetType = ThemeComponentType.TextColor;
|
||||
const string TestInputComponentName = "test";
|
||||
|
||||
theme.AddComponent(testInputComponentTargetType, TestInputComponentName, new Color());
|
||||
|
||||
// Act
|
||||
var result = theme.ComponentExists(ThemeComponentType.BorderColor, TestInputComponentName);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(false, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ComponentExists_ComponentDoesNotExist_NoComponents_ReturnsFalse()
|
||||
{
|
||||
// Arrange
|
||||
var theme = new Theme();
|
||||
|
||||
// Act
|
||||
var result = theme.ComponentExists(ThemeComponentType.BorderColor, "test");
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(false, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
67
Filtration.ThemeEditor.Tests/Services/TestThemeService.cs
Normal file
67
Filtration.ThemeEditor.Tests/Services/TestThemeService.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System.Windows.Media;
|
||||
using Filtration.ObjectModel;
|
||||
using Filtration.ObjectModel.BlockItemTypes;
|
||||
using Filtration.ObjectModel.Enums;
|
||||
using Filtration.ObjectModel.ThemeEditor;
|
||||
using Filtration.ThemeEditor.Services;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Filtration.ThemeEditor.Tests.Services
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestThemeService
|
||||
{
|
||||
[Test]
|
||||
public void ApplyThemeToScript_SingleBlock_ReplacesColor()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var testInputBlockItem = new TextColorBlockItem();
|
||||
var testInputBlock = new ItemFilterBlock();
|
||||
testInputBlock.BlockItems.Add(testInputBlockItem);
|
||||
var testInputScript = new ItemFilterScript();
|
||||
testInputScript.ItemFilterBlocks.Add(testInputBlock);
|
||||
|
||||
var testInputTheme = new Theme();
|
||||
var testInputThemeComponentColor = new Color{ R = 255, G = 0, B = 1 };
|
||||
var testInputThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Test Component 1", testInputThemeComponentColor);
|
||||
testInputTheme.Components.Add(testInputThemeComponent);
|
||||
testInputBlockItem.ThemeComponent = testInputThemeComponent;
|
||||
|
||||
var service = new ThemeService();
|
||||
|
||||
// Act
|
||||
service.ApplyThemeToScript(testInputTheme, testInputScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(testInputThemeComponentColor, testInputBlockItem.Color);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ApplyThemeToScript_SingleBlockDifferentComponentName_DoesNotReplaceColour()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var testInputBlockItem = new TextColorBlockItem();
|
||||
var testInputBlock = new ItemFilterBlock();
|
||||
testInputBlock.BlockItems.Add(testInputBlockItem);
|
||||
var testInputScript = new ItemFilterScript();
|
||||
testInputScript.ItemFilterBlocks.Add(testInputBlock);
|
||||
|
||||
var testInputTheme = new Theme();
|
||||
var testInputThemeComponentColor = new Color { R = 255, G = 0, B = 1 };
|
||||
var testInputThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Test Component 1", testInputThemeComponentColor);
|
||||
var testInputBlockItemThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Different Component", testInputThemeComponentColor);
|
||||
testInputTheme.Components.Add(testInputThemeComponent);
|
||||
testInputBlockItem.ThemeComponent = testInputBlockItemThemeComponent;
|
||||
|
||||
var service = new ThemeService();
|
||||
|
||||
// Act
|
||||
service.ApplyThemeToScript(testInputTheme, testInputScript);
|
||||
|
||||
// Assert
|
||||
Assert.AreNotEqual(testInputThemeComponentColor, testInputBlockItem.Color);
|
||||
}
|
||||
}
|
||||
}
|
||||
5
Filtration.ThemeEditor.Tests/packages.config
Normal file
5
Filtration.ThemeEditor.Tests/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Moq" version="4.2.1506.2515" targetFramework="net451" />
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net451" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user