From 9c17b2bfa711a613f2aee0d3f2d0f930ed77bff9 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: 09500b2f016bcd60227df7bee7f5fd0cd5ec9e7f --- .../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 +