Beispiel #1
0
        public void Count_With_Enumerable_ValueType(int expected)
        {
            // Arrange
            IEnumerable <int> source = TestEnumerable.ValueType(expected);

            // Act
            var result = source.Count();

            // Assert
            result.Should().Be(expected);
        }
        public void Single_With_MoreThanElement_Should_Throw()
        {
            // Arrange
            var empty = TestEnumerable.ValueType(2);

            // Act
            Action action = () => empty.SingleOrDefault();

            // Assert
            action.Should()
            .ThrowExactly <InvalidOperationException>()
            .WithMessage("Sequence contains more than one element");
        }
Beispiel #3
0
        public void First_With_EmptyIEnumerable_Should_Throw()
        {
            // Arrange
            var empty = TestEnumerable.ValueType(0);

            // Act
            Action action = () => empty.First();

            // Assert
            action.Should()
            .ThrowExactly <InvalidOperationException>()
            .WithMessage("Sequence contains no elements");
        }