mirror of https://github.com/SixLabors/ImageSharp
24 changed files with 209 additions and 50 deletions
@ -0,0 +1,81 @@ |
|||||
|
namespace ImageProcessor.Tests |
||||
|
{ |
||||
|
#region Using
|
||||
|
using System; |
||||
|
using System.Diagnostics; |
||||
|
using System.Drawing; |
||||
|
using System.IO; |
||||
|
using System.Text.RegularExpressions; |
||||
|
using ImageProcessor.Imaging; |
||||
|
using ImageProcessor.Processors; |
||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting; |
||||
|
#endregion
|
||||
|
|
||||
|
[TestClass] |
||||
|
public class RegularExpressionUnitTests |
||||
|
{ |
||||
|
#region Regular Expression Tests
|
||||
|
[TestMethod] |
||||
|
public void TestAlphaRegex() |
||||
|
{ |
||||
|
string querystring = "alpha=56"; |
||||
|
int expected = 56; |
||||
|
|
||||
|
Alpha alpha = new Alpha(); |
||||
|
alpha.MatchRegexIndex(querystring); |
||||
|
|
||||
|
int actual = alpha.DynamicParameter; |
||||
|
|
||||
|
Assert.AreEqual<int>(expected, actual); |
||||
|
} |
||||
|
|
||||
|
[TestMethod] |
||||
|
public void TestFormatRegex() |
||||
|
{ |
||||
|
string querystring = "format=gif"; |
||||
|
string expected = "gif"; |
||||
|
|
||||
|
Format format = new Format(); |
||||
|
format.MatchRegexIndex(querystring); |
||||
|
|
||||
|
string actual = format.DynamicParameter; |
||||
|
|
||||
|
Assert.AreEqual(expected, actual); |
||||
|
} |
||||
|
|
||||
|
[TestMethod] |
||||
|
public void TestQualityRegex() |
||||
|
{ |
||||
|
string querystring = "quality=56"; |
||||
|
int expected = 56; |
||||
|
|
||||
|
Quality quality = new Quality(); |
||||
|
quality.MatchRegexIndex(querystring); |
||||
|
|
||||
|
int actual = quality.DynamicParameter; |
||||
|
|
||||
|
Assert.AreEqual<int>(expected, actual); |
||||
|
} |
||||
|
|
||||
|
[TestMethod] |
||||
|
public void TestRotateRegex() |
||||
|
{ |
||||
|
string querystring = "rotate=270"; |
||||
|
RotateLayer expected = new RotateLayer |
||||
|
{ |
||||
|
Angle = 270, |
||||
|
BackgroundColor = Color.Transparent |
||||
|
}; |
||||
|
|
||||
|
Rotate rotate = new Rotate(); |
||||
|
rotate.MatchRegexIndex(querystring); |
||||
|
|
||||
|
RotateLayer actual = rotate.DynamicParameter; |
||||
|
|
||||
|
Debug.Print("{0}{1}", actual.Angle, actual.BackgroundColor); |
||||
|
|
||||
|
Assert.AreEqual<RotateLayer>(expected, actual); |
||||
|
} |
||||
|
#endregion
|
||||
|
} |
||||
|
} |
||||
@ -1,18 +0,0 @@ |
|||||
using System; |
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting; |
|
||||
|
|
||||
namespace ImageProcessor.Tests |
|
||||
{ |
|
||||
using System.IO; |
|
||||
|
|
||||
[TestClass] |
|
||||
public class UnitTest1 |
|
||||
{ |
|
||||
[TestMethod] |
|
||||
public void TestMethod1() |
|
||||
{ |
|
||||
|
|
||||
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,3 @@ |
|||||
|
version https://git-lfs.github.com/spec/v1 |
||||
|
oid sha256:977cc9071257655c9923d267ea5bd417b69754367c2f1aa8765247b68e2bb878 |
||||
|
size 1539 |
||||
@ -0,0 +1 @@ |
|||||
|
ba8235d9051c4409559b4ec943172574041c0cf0 |
||||
Loading…
Reference in new issue