From 5f3483ca26b878bdcdcff77523201076031357ab Mon Sep 17 00:00:00 2001 From: Thomas Broust Date: Sun, 29 Jun 2014 23:41:33 +0200 Subject: [PATCH] Adds a few unit tests for integer extension methods Former-commit-id: 456bf78a23c676691a90f7bfe1149673e5e0d79d --- .../Extensions/IntegerExtensionsUnitTests.cs | 38 +++++++++++++++++++ .../ImageProcessor.UnitTests.csproj | 1 + 2 files changed, 39 insertions(+) create mode 100644 src/ImageProcessor.UnitTests/Extensions/IntegerExtensionsUnitTests.cs diff --git a/src/ImageProcessor.UnitTests/Extensions/IntegerExtensionsUnitTests.cs b/src/ImageProcessor.UnitTests/Extensions/IntegerExtensionsUnitTests.cs new file mode 100644 index 000000000..1e85e633b --- /dev/null +++ b/src/ImageProcessor.UnitTests/Extensions/IntegerExtensionsUnitTests.cs @@ -0,0 +1,38 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// Copyright (c) James South. +// Licensed under the Apache License, Version 2.0. +// +// +// Runs unit tests on the extension methods +// +// -------------------------------------------------------------------------------------------------------------------- + +namespace ImageProcessor.UnitTests +{ + using System; + using Common.Extensions; + using NUnit.Framework; + + /// + /// Provides a test harness for the integer extension class + /// + [TestFixture] + public class IntegerExtensionsUnitTests + { + /// + /// Tests the "ToByte" extension + /// + /// Integer input + /// Expected result + [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); + } + } +} \ No newline at end of file diff --git a/src/ImageProcessor.UnitTests/ImageProcessor.UnitTests.csproj b/src/ImageProcessor.UnitTests/ImageProcessor.UnitTests.csproj index e715df657..b545a11d9 100644 --- a/src/ImageProcessor.UnitTests/ImageProcessor.UnitTests.csproj +++ b/src/ImageProcessor.UnitTests/ImageProcessor.UnitTests.csproj @@ -47,6 +47,7 @@ PreserveNewest +