Beispiel #1
0
        public void ElementAt_With_ValidData_Must_Return_Some(int[] source)
        {
            // Arrange
            var list = source.ToList();

            for (var index = 0; index < source.Length; index++)
            {
                // Act
                var result = ListBindings
                             .ElementAt(list, index);

                // Assert
                _ = result.Match(
                    value => value.Must().BeEqualTo(source[index]),
                    () => throw new Exception());
            }
        }
Beispiel #2
0
        public void ElementAt_With_OutOfRange_Must_Return_None(int[] source)
        {
            // Arrange
            var list = source.ToList();

            // Act
            var optionTooSmall = ListBindings
                                 .ElementAt(list, -1);
            var optionTooLarge = ListBindings
                                 .ElementAt(list, source.Length);

            // Assert
            _ = optionTooSmall.Must()
                .BeOfType <Option <int> >()
                .EvaluateTrue(option => option.IsNone);
            _ = optionTooLarge.Must()
                .BeOfType <Option <int> >()
                .EvaluateTrue(option => option.IsNone);
        }