Beispiel #1
0
        public void PerformanceTest()
        {
            TrimStringTransform transform = new TrimStringTransform();

            transform.TrimType = TrimType.Left;

            int cycles = 200000;

            Stopwatch t = new Stopwatch();

            t.Start();

            for (int i = 0; i < cycles; i++)
            {
                Assert.AreEqual("1234", transform.TransformValue("    1234").FirstOrDefault());
            }

            t.Stop();
            int objSec = (int)(cycles / t.Elapsed.TotalSeconds);

            if (objSec < 500000)
            {
                Assert.Fail("Perf test failed: {0} obj/sec", objSec);
            }
        }
Beispiel #2
0
        private void ExecuteTestTrimString(TrimStringTransform transform, string sourceValue, string expectedValue)
        {
            string outValue = transform.TransformValue(sourceValue).FirstOrDefault() as string;

            Assert.AreEqual(expectedValue, outValue);
        }