コード例 #1
0
        public virtual void TestPermutate()
        {
            var set = PermutationUtil.PermutateSQL("-", "1");

            Assert.AreEqual(1, set.Count);
            Assert.IsTrue(set.Contains("1"));
            set = PermutationUtil.PermutateSQL("-", "1", "1");
            Assert.AreEqual(1, set.Count);
            Assert.IsTrue(set.Contains("1-1"));
            set = PermutationUtil.PermutateSQL("-", "1", "2");
            Assert.AreEqual(2, set.Count);
            Assert.IsTrue(set.Contains("1-2"));
            Assert.IsTrue(set.Contains("2-1"));
            set = PermutationUtil.PermutateSQL("-", "1", "2", "2");
            Assert.AreEqual(3, set.Count);
            Assert.IsTrue(set.Contains("1-2-2"));
            Assert.IsTrue(set.Contains("2-1-2"));
            Assert.IsTrue(set.Contains("2-2-1"));
            set = PermutationUtil.PermutateSQL("-", "1", "2", "3");
            Assert.AreEqual(6, set.Count);
            Assert.IsTrue(set.Contains("1-2-3"));
            Assert.IsTrue(set.Contains("1-3-2"));
            Assert.IsTrue(set.Contains("2-1-3"));
            Assert.IsTrue(set.Contains("2-3-1"));
            Assert.IsTrue(set.Contains("3-2-1"));
            Assert.IsTrue(set.Contains("3-1-2"));
        }
コード例 #2
0
 public virtual void TestPermutateNull()
 {
     try
     {
         PermutationUtil.PermutateSQL("-");
         Assert.IsFalse(true);
     }
     catch (ArgumentException)
     {
         Assert.IsTrue(true);
     }
     catch
     {
         Assert.IsFalse(true);
     }
 }
コード例 #3
0
 public virtual SimpleSqlAsserter AddExpectSql(int nodeIndex,
                                               string prefix,
                                               PermutationUtil.PermutationGenerator pg,
                                               string suffix)
 {
     var ss = pg.PermutateSql();
     foreach (var s in ss)
     {
         AddExpectSql(nodeIndex, prefix + s + suffix);
     }
     return this;
 }