Browse Source

Added a few unit tests

Former-commit-id: ef5cdc53c7a7065ee62f14810d15a9faed964818
af/merge-core
JimBobSquarePants 13 years ago
parent
commit
b44c2d05d4
  1. 56
      src/ImageProcessor.Tests/RegularExpressionUnitTests.cs

56
src/ImageProcessor.Tests/RegularExpressionUnitTests.cs

@ -39,6 +39,40 @@ namespace ImageProcessor.Tests
Assert.AreEqual(Expected, actual);
}
/// <summary>
/// The brightness regex unit test.
/// </summary>
[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);
}
/// <summary>
/// The contrast regex unit test.
/// </summary>
[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);
}
/// <summary>
/// The rotate regex unit test.
/// </summary>
@ -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);
}
/// <summary>
/// The rounded corners regex unit test.
/// </summary>
[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
}

Loading…
Cancel
Save