예제 #1
0
        public void First_With_Empty_Must_Return_None(int[] source)
        {
            // Arrange
            var wrapped = Wrap
                          .AsValueEnumerable(source);

            // Act
            var result = ValueEnumerableExtensions
                         .First <Wrap.ValueEnumerableWrapper <int>, Wrap.Enumerator <int>, int>(wrapped);

            // Assert
            _ = result.Must()
                .BeOfType <Option <int> >()
                .EvaluateTrue(option => option.IsNone);
        }
예제 #2
0
        public void First_With_ValidData_Must_Return_Some(int[] source)
        {
            // Arrange
            var wrapped = Wrap
                          .AsValueEnumerable(source);
            var expected = Enumerable
                           .First(source);

            // Act
            var result = ValueEnumerableExtensions
                         .First <Wrap.ValueEnumerableWrapper <int>, Wrap.Enumerator <int>, int>(wrapped);

            // Assert
            _ = result.Match(
                value => value.Must().BeEqualTo(expected),
                () => throw new Exception());
        }