Static methods for dynamically skipping tests identified with the SkippableFactAttribute.
Esempio n. 1
0
        public void KnownComparisons()
        {
            var s1_lower = new Skip { Number = 1, What = Skip.SkipType.Day };
            var s1_upper = new Skip { Number = 10, What = Skip.SkipType.Day };

            var s2_lower = new Skip { Number = 2, What = Skip.SkipType.Week };
            var s2_upper = new Skip { Number = 100, What = Skip.SkipType.Week };

            Assert.True(s1_lower.Compare(s1_lower, s1_upper)==-1);
            Assert.True(s1_upper.Compare(s1_upper, s1_lower) == 1);

            Assert.True(s2_lower.Compare(s2_lower, s2_upper) == -1);
            Assert.True(s2_upper.Compare(s2_upper, s2_lower) == 1);

            Assert.True(s1_lower.Compare(s1_lower, s2_lower) == -1);
            Assert.True(s1_lower.Compare(s2_lower, s2_upper) == -1);
            Assert.True(s1_lower.Compare(s1_upper, s2_upper) == -1);

            List<Skip> unsorted = new List<Skip> { s1_lower, s1_upper, s2_lower, s2_upper };
            unsorted.Sort();

            var sorted = unsorted;
            Assert.Equal(sorted[0], s1_lower);
            Assert.Equal(sorted[1], s1_upper);
            Assert.Equal(sorted[2], s2_lower);
            Assert.Equal(sorted[3], s2_upper);
        }
Esempio n. 2
0
        public void BasicSkipObjectComparison()
        {
            var s1 = new Skip { Number = 1, What = Skip.SkipType.Day };

            Assert.Equal(s1, s1);
            Assert.Equal(0, s1.Compare(s1,s1));
        }
Esempio n. 3
0
 /// <summary>
 /// Throws an exception that results in a "Skipped" result for the test.
 /// </summary>
 /// <param name="condition">The condition that must evaluate to <c>false</c> for the test to be skipped.</param>
 /// <param name="reason">The explanation for why the test is skipped.</param>
 public static void IfNot(
     [DoesNotReturnIf(false)] bool condition,
     string?reason = null)
 {
     Skip.If(!condition, reason);
 }