Browse Source

Adds a few unit tests for integer extension methods

Former-commit-id: 456bf78a23c676691a90f7bfe1149673e5e0d79d
af/merge-core
Thomas Broust 12 years ago
parent
commit
5f3483ca26
  1. 38
      src/ImageProcessor.UnitTests/Extensions/IntegerExtensionsUnitTests.cs
  2. 1
      src/ImageProcessor.UnitTests/ImageProcessor.UnitTests.csproj

38
src/ImageProcessor.UnitTests/Extensions/IntegerExtensionsUnitTests.cs

@ -0,0 +1,38 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IntegerExtensionsUnitTests.cs" company="James South">
// Copyright (c) James South.
// Licensed under the Apache License, Version 2.0.
// </copyright>
// <summary>
// Runs unit tests on the <see cref="IntegerExtensions" /> extension methods
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace ImageProcessor.UnitTests
{
using System;
using Common.Extensions;
using NUnit.Framework;
/// <summary>
/// Provides a test harness for the integer extension class
/// </summary>
[TestFixture]
public class IntegerExtensionsUnitTests
{
/// <summary>
/// Tests the "ToByte" extension
/// </summary>
/// <param name="input">Integer input</param>
/// <param name="expected">Expected result</param>
[Test]
[TestCase(21, 0x15)]
[TestCase(190, 0xBE)]
[TestCase(3156, 0xFF)]
public void ToByteTest(int input, byte expected)
{
var result = input.ToByte();
Assert.AreEqual(expected, result);
}
}
}

1
src/ImageProcessor.UnitTests/ImageProcessor.UnitTests.csproj

@ -47,6 +47,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Compile>
<Compile Include="Extensions\DoubleExtensionsUnitTests.cs" />
<Compile Include="Extensions\IntegerExtensionsUnitTests.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>

Loading…
Cancel
Save