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

            transform.SplitRegex = ",";

            int cycles = 200000;

            Stopwatch t = new Stopwatch();

            t.Start();

            for (int i = 0; i < cycles; i++)
            {
                CollectionAssert.AreEqual(new string[] { "1", "2", "3" }, transform.TransformValue("1,2,3").ToArray());
            }

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

            if (objSec < 150000)
            {
                Assert.Fail("Perf test failed: {0} obj/sec", objSec);
            }
        }
Beispiel #2
0
        public void TestSimpleTransform3()
        {
            StringSplitTransform transform = new StringSplitTransform();

            transform.SplitRegex = ",";

            this.ExecuteTest(transform, new List <object>()
            {
                null
            }, new List <string>());
        }
Beispiel #3
0
        public void TestSimpleTransform2()
        {
            StringSplitTransform transform = new StringSplitTransform();

            transform.SplitRegex = ",";

            this.ExecuteTest(transform, new List <object>()
            {
                "1,2,3", "4,5"
            }, new List <string>()
            {
                "1", "2", "3", "4", "5"
            });
        }
Beispiel #4
0
        public void TestSerialization()
        {
            UniqueIDCache.ClearIdCache();
            StringSplitTransform transformToSeralize = new StringSplitTransform();

            transformToSeralize.ID         = "test001";
            transformToSeralize.SplitRegex = ",";
            UniqueIDCache.ClearIdCache();

            StringSplitTransform deserializedTransform = (StringSplitTransform)UnitTestControl.XmlSerializeRoundTrip <Transform>(transformToSeralize);

            Assert.AreEqual(transformToSeralize.ID, deserializedTransform.ID);
            Assert.AreEqual(transformToSeralize.SplitRegex, deserializedTransform.SplitRegex);
        }
 public StringSplitTransformViewModel(StringSplitTransform model)
     : base(model)
 {
     this.model = model;
 }
Beispiel #6
0
        private void ExecuteTest(StringSplitTransform transform, IList <object> sourceValues, IList <string> expectedValues)
        {
            IList <object> outValues = transform.TransformValue(sourceValues);

            CollectionAssert.AreEqual(expectedValues.ToArray(), outValues.ToArray());
        }