Exemple #1
0
        public void Transformations_AbstractTrace_ResolveMany1()
        {
            var list = new List <string>();

            list.Add("a");
            AssertExtensions.AssertContainsOnly(trace.ResolveManyIn <string, string>(ruleT1, list), "b");
            AssertExtensions.AssertContainsOnly(trace.ResolveMany <string, string>(list), "b");

            list.Clear();
            list.Add("b");
            AssertExtensions.AssertContainsOnly(trace.ResolveManyIn <string, string>(ruleT1, list), null);
            AssertExtensions.AssertContainsOnly(trace.ResolveMany <string, string>(list), null);
            list.Clear();
            list.Add("c");
            Assert.IsTrue(trace.ResolveManyIn <string, string>(ruleT1, list).IsNullOrEmpty());
            Assert.IsTrue(trace.ResolveManyIn <string, string>(ruleT1, list).IsNullOrEmpty());

            list.Add("a");
            list.Add("b");
            var collection = trace.ResolveManyIn <string, string>(ruleT1, list);

            Assert.AreEqual(2, collection.Count());
            Assert.IsTrue(collection.Contains("b"));
            Assert.IsTrue(collection.Contains(null));
        }
Exemple #2
0
 public void Transformations_AbstractTrace_TraceWhere1()
 {
     AssertExtensions.AssertContainsOnly(trace.TraceInWhere(ruleT1, (object[] o) => object.Equals(o[0], "a")), c_a);
     AssertExtensions.AssertContainsOnly(trace.TraceInWhere(ruleT1, (object[] o) => object.Equals(o[0], "b")), c_b);
     AssertExtensions.AssertContainsOnly(trace.TraceInWhere(ruleT2, (object[] o) => object.Equals(o[0], "a") && object.Equals(o[1], "b")), c_ab);
     AssertExtensions.AssertContainsOnly(trace.TraceInWhere(ruleT2, (object[] o) => object.Equals(o[0], "b") && object.Equals(o[1], "c")), c_bc);
     AssertExtensions.AssertContainsOnly(trace.TraceInWhere(ruleTN, (object[] o) => object.Equals(o[0], "a") && object.Equals(o[1], "b") && object.Equals(o[2], "c")), c_abc);
     AssertExtensions.AssertContainsOnly(trace.TraceInWhere(ruleTN, (object[] o) => object.Equals(o[0], "b") && object.Equals(o[1], "c") && object.Equals(o[2], "d")), c_bcd);
 }
Exemple #3
0
        public void Transformations_AbstractTrace_TraceWhere3()
        {
            AssertExtensions.AssertContainsOnly(trace.TraceInWhere <string, string>(ruleT2, (s1, s2) => s1 == "a" && s2 == "b"), c_ab);
            AssertExtensions.AssertContainsOnly(trace.TraceInWhere <string, string>(ruleT2, (s1, s2) => s1 == "b" && s2 == "c"), c_bc);
            Assert.IsTrue(trace.TraceInWhere <string, string>(ruleT2, (s1, s2) => s1 == "c" && s2 == "d").IsNullOrEmpty());

            AssertExtensions.AssertContainsOnly(trace.TraceInWhere <string, string>(ruleT2, (s1, s2) => s1 == "a" && s2 == "b"), c_ab);
            AssertExtensions.AssertContainsOnly(trace.TraceInWhere <string, string>(ruleT2, (s1, s2) => s1 == "b" && s2 == "c"), c_bc);
            Assert.IsTrue(trace.TraceInWhere <string, string>(ruleT2, (s1, s2) => s1 == "c" && s2 == "d").IsNullOrEmpty());
        }
Exemple #4
0
        public void Transformations_AbstractTrace_TraceWhere2()
        {
            AssertExtensions.AssertContainsOnly(trace.TraceInWhere <string>(ruleT1, filter: s => s == "a"), c_a);
            AssertExtensions.AssertContainsOnly(trace.TraceInWhere <string>(ruleT1, filter: s => s == "b"), c_b);
            Assert.IsTrue(trace.TraceInWhere <string>(ruleT1, filter: s => s == "c").IsNullOrEmpty());

            AssertExtensions.AssertContainsOnly(trace.TraceInWhere <string>(ruleT1, s => s == "a"), c_a);
            AssertExtensions.AssertContainsOnly(trace.TraceInWhere <string>(ruleT1, s => s == "b"), c_b);
            Assert.IsTrue(trace.TraceInWhere <string>(ruleT1, s => s == "c").IsNullOrEmpty());
        }
Exemple #5
0
 public void Transformations_AbstractTrace_ResolveWhere1()
 {
     AssertExtensions.AssertContainsOnly(trace.ResolveInWhere(ruleT1, s => s == "a"), "b");
     AssertExtensions.AssertContainsOnly(trace.ResolveInWhere(ruleT1, s => s == "b"), null);
     trace.ResolveInWhere(ruleT1, o => true).AssertContainsOnly("b", null);
     trace.ResolveInWhere(ruleT1, null as Predicate <string>).AssertContainsOnly("b", null);
     AssertExtensions.AssertContainsOnly(trace.ResolveInWhere(ruleT2, (s1, s2) => s1 == "a" && s2 == "b"), "c");
     AssertExtensions.AssertContainsOnly(trace.ResolveInWhere(ruleT2, (s1, s2) => s1 == "b" && s2 == "c"), null);
     trace.ResolveInWhere(ruleT2, o => true).AssertContainsOnly("c", null);
     trace.ResolveInWhere(ruleT2, null as Func <string, string, bool>).AssertContainsOnly("c", null);
     AssertExtensions.AssertContainsOnly(trace.ResolveInWhere(ruleTN, o => object.Equals(o[0], "a") && object.Equals(o[1], "b") && object.Equals(o[2], "c")), "d");
     AssertExtensions.AssertContainsOnly(trace.ResolveInWhere(ruleTN, o => object.Equals(o[0], "b") && object.Equals(o[1], "c") && object.Equals(o[2], "d")), null);
     trace.ResolveInWhere(ruleTN, o => true).AssertContainsOnly("d", null);
     trace.ResolveInWhere(ruleTN, null as Predicate <object[]>).AssertContainsOnly("d", null);
 }
Exemple #6
0
        public void Transformations_AbstractTrace_ResolveWhere2()
        {
            AssertExtensions.AssertContainsOnly(trace.ResolveInWhere <string>(ruleTN, o => o.ArrayEquals(new object[] { "a", "b", "c" })), "d");
            AssertExtensions.AssertContainsOnly(trace.ResolveInWhere <string>(ruleTN, o => o.ArrayEquals(new object[] { "b", "c", "d" })), null);
            trace.ResolveInWhere <string>(ruleTN, o => o.ArrayEquals(new object[] { "c", "d", "e" })).AssertEmpty();

            var types = new Type[] { typeof(string), typeof(string), typeof(string) };

            AssertExtensions.AssertContainsOnly(trace.ResolveWhere <string>(types, o => o.ArrayEquals(new object[] { "a", "b", "c" })), "d");
            AssertExtensions.AssertContainsOnly(trace.ResolveWhere <string>(types, o => o.ArrayEquals(new object[] { "b", "c", "d" })), null);
            trace.ResolveWhere <string>(types, o => o.ArrayEquals(new object[] { "c", "d", "e" })).AssertEmpty();

            trace.ResolveWhere <string, string>(s => s == "a").AssertContainsOnly("b");
            trace.ResolveWhere <string, string>(s => s == "b").AssertContainsOnly(null);
            trace.ResolveWhere <string, string>(null).AssertContainsOnly("b", null);

            trace.ResolveWhere <string, string, string>((s1, s2) => s1 == "a" && s2 == "b").AssertContainsOnly("c");
            trace.ResolveWhere <string, string, string>((s1, s2) => s1 == "b" && s2 == "c").AssertContainsOnly(null);
            trace.ResolveWhere <string, string, string>(null).AssertContainsOnly("c", null);
        }
Exemple #7
0
 public void Transformations_AbstractTrace_TraceWhere4()
 {
     AssertExtensions.AssertContainsOnly(trace.TraceInWhere(ruleTN, o => o.ArrayEquals(new object[] { "a", "b", "c" })), c_abc);
     AssertExtensions.AssertContainsOnly(trace.TraceInWhere(ruleTN, o => o.ArrayEquals(new object[] { "b", "c", "d" })), c_bcd);
     Assert.IsTrue(trace.TraceInWhere(ruleTN, o => o.ArrayEquals(new object[] { "c", "d", "e" })).IsNullOrEmpty());
 }