Esempio n. 1
0
        public static void Returns_false_when_actual_count_higher_than_expected_count_with_predicate()
        {
            IEnumerable<string> fruits = new[] { "apple", "apricot", "banana" };
            Func<string, bool> startsWithLowercasedA = fruit => fruit.StartsWith("a");

            fruits.HasAtMost(0, startsWithLowercasedA).Should().BeFalse();
            fruits.HasAtMost(1, startsWithLowercasedA).Should().BeFalse();
        }
Esempio n. 2
0
        public static void Returns_true_when_actual_count_is_equal_to_or_lower_than_expected_count_with_predicate()
        {
            IEnumerable<string> fruits = new[] { "apple", "apricot", "banana" };
            Func<string, bool> startsWithLowercasedA = fruit => fruit.StartsWith("a");

            fruits.HasAtMost(2, startsWithLowercasedA).Should().BeTrue();
            fruits.HasAtMost(3, startsWithLowercasedA).Should().BeTrue();
            fruits.HasAtMost(int.MaxValue, startsWithLowercasedA).Should().BeTrue();
        }