Browse Source

Adds a few unit tests for integer extension methods

Former-commit-id: 09500b2f016bcd60227df7bee7f5fd0cd5ec9e7f
pull/17/head
Thomas Broust 12 years ago
parent
commit
9c17b2bfa7
  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