From b44c2d05d4b015fc115a1ebce4c3dcad64f1ce75 Mon Sep 17 00:00:00 2001 From: JimBobSquarePants Date: Sun, 30 Jun 2013 21:05:23 +0100 Subject: [PATCH] Added a few unit tests Former-commit-id: ef5cdc53c7a7065ee62f14810d15a9faed964818 --- .../RegularExpressionUnitTests.cs | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/src/ImageProcessor.Tests/RegularExpressionUnitTests.cs b/src/ImageProcessor.Tests/RegularExpressionUnitTests.cs index c9d2da462..3e928e3be 100644 --- a/src/ImageProcessor.Tests/RegularExpressionUnitTests.cs +++ b/src/ImageProcessor.Tests/RegularExpressionUnitTests.cs @@ -39,6 +39,40 @@ namespace ImageProcessor.Tests Assert.AreEqual(Expected, actual); } + /// + /// The brightness regex unit test. + /// + [TestMethod] + public void TestBrightnessRegex() + { + const string Querystring = "brightness=56"; + const int Expected = 56; + + Brightness brightness = new Brightness(); + brightness.MatchRegexIndex(Querystring); + + int actual = brightness.DynamicParameter; + + Assert.AreEqual(Expected, actual); + } + + /// + /// The contrast regex unit test. + /// + [TestMethod] + public void TestContrastRegex() + { + const string Querystring = "contrast=56"; + const int Expected = 56; + + Contrast contrast = new Contrast(); + contrast.MatchRegexIndex(Querystring); + + int actual = contrast.DynamicParameter; + + Assert.AreEqual(Expected, actual); + } + /// /// The rotate regex unit test. /// @@ -139,9 +173,25 @@ namespace ImageProcessor.Tests RotateLayer actual = rotate.DynamicParameter; - // Can't use are equal on rotatelayer for some reason so test the two properties. - Assert.AreEqual(expected.Angle, actual.Angle); - Assert.AreEqual(expected.BackgroundColor, actual.BackgroundColor); + Assert.AreEqual(expected, actual); + } + + + /// + /// The rounded corners regex unit test. + /// + [TestMethod] + public void TestRoundedCornersRegex() + { + const string Querystring = "roundedcorners=30"; + RoundedCornerLayer expected = new RoundedCornerLayer(30, true, true, true, true); + + RoundedCorners roundedCorners = new RoundedCorners(); + roundedCorners.MatchRegexIndex(Querystring); + + RoundedCornerLayer actual = roundedCorners.DynamicParameter; + + Assert.AreEqual(expected, actual); } #endregion }