public void TestCropRegexMatches(string input, int expected) { Processors.Crop crop = new Processors.Crop(); int index = crop.MatchRegexIndex(input); Assert.AreEqual(expected, index); }
public void TestCropRegex() { const string Querystring = "crop=0,0,150,300"; CropLayer expected = new CropLayer(0, 0, 150, 300, CropMode.Pixels); Processors.Crop crop = new Processors.Crop(); crop.MatchRegexIndex(Querystring); CropLayer actual = crop.Processor.DynamicParameter; Assert.AreEqual(expected, actual); }
public void TestCropRegex() { Dictionary <string, CropLayer> data = new Dictionary <string, CropLayer> { { "crop=0,0,150,300", new CropLayer(0, 0, 150, 300, CropMode.Pixels) }, { "crop=0.1,0.1,.2,.2&cropmode=percentage", new CropLayer(0.1f, 0.1f, 0.2f, 0.2f, CropMode.Percentage) } }; Processors.Crop crop = new Processors.Crop(); foreach (KeyValuePair <string, CropLayer> item in data) { crop.MatchRegexIndex(item.Key); CropLayer result = crop.Processor.DynamicParameter; Assert.AreEqual(item.Value, result); } }
public void TestCropRegex() { Dictionary<string, CropLayer> data = new Dictionary<string, CropLayer> { { "crop=0,0,150,300", new CropLayer(0, 0, 150, 300, CropMode.Pixels) }, { "crop=0.1,0.1,.2,.2&cropmode=percentage", new CropLayer(0.1f, 0.1f, 0.2f, 0.2f, CropMode.Percentage) } }; Processors.Crop crop = new Processors.Crop(); foreach (KeyValuePair<string, CropLayer> item in data) { crop.MatchRegexIndex(item.Key); CropLayer result = crop.Processor.DynamicParameter; Assert.AreEqual(item.Value, result); } }