public void LazyEqualToShouldThrowIfValueProviderIsNull()
        {
            Action action = () => Pattern.EqualTo((Func <int>)null);

            action.Should().Throw <ArgumentNullException>();
        }
 public Property AnyShouldAlwaysSucceed(string x)
 => Pattern.Any <string>().Match(x).IsSome.ToProperty();
 public Property LazyEqualToShouldSucceedOnlyOnEqualObjects(string x, string y)
 => (Equals(x, y) == Pattern.EqualTo(() => y).Match(x).IsSome).ToProperty();
 public void OperatorNotTypeShouldFailOnlyWhenTheValueHasType()
 {
     (~Pattern.Type <object, int>()).Match(1).IsSome.Should().BeFalse();
     (~Pattern.Type <object, string>()).Match("string").IsSome.Should().BeFalse();
     (~Pattern.Type <object, object>()).Match(null).IsSome.Should().BeTrue();
 }
        public void PatternConstructorShouldThrowForNull()
        {
            Action action = () => { var _ = new Pattern <string, string>(null); };

            action.Should().Throw <ArgumentNullException>();
        }
 public Property OperatorNotValueNullShouldBeOppositeToValueNull(int?x)
 => (Pattern.ValueNull <int>().Match(x).IsSome == (~Pattern.ValueNull <int>()).Match(x).IsNone).ToProperty();
        public void NotShouldThrowIfPatternIsNull()
        {
            Action action = () => Pattern.Not <object, object>(null);

            action.Should().Throw <ArgumentNullException>();
        }
 public void TypeShouldSucceedOnlyWhenTheValueHasType()
 {
     Pattern.Type <object, int>().Match(1).IsSome.Should().BeTrue();
     Pattern.Type <object, string>().Match("string").IsSome.Should().BeTrue();
     Pattern.Type <object, object>().Match(null).IsSome.Should().BeFalse();
 }
 public Property NotPatternShouldBeOppositeToPattern(SimplePattern <string> pattern, string x)
 => (pattern.Match(x).IsSome == Pattern.Not(pattern).Match(x).IsNone).ToProperty();
 public Property LazyGreaterOrEqualShouldSucceedOnlyWhenValueIsGreaterOrEqual(string x, string y)
 => (Comparer <string> .Default.Compare(x, y) >= 0 == Pattern.GreaterOrEqual(() => y).Match(x).IsSome).ToProperty();
        public void LazyGreaterThanShouldThrowIfValueProviderIsNull()
        {
            Action action = () => Pattern.GreaterThan((Func <int>)null);

            action.Should().Throw <ArgumentNullException>();
        }
 public Property GreaterThanShouldSucceedOnlyWhenValueIsLGreater(string x, string y)
 => (Comparer <string> .Default.Compare(x, y) > 0 == Pattern.GreaterThan(y).Match(x).IsSome).ToProperty();
 public Property LessOrEqualShouldSucceedOnlyWhenValueIsLessOrEqual(string x, string y)
 => (Comparer <string> .Default.Compare(x, y) <= 0 == Pattern.LessOrEqual(y).Match(x).IsSome).ToProperty();
 public Property LazyLessThanShouldSucceedOnlyWhenValueIsLess(string x, string y)
 => (Comparer <string> .Default.Compare(x, y) < 0 == Pattern.LessThan(() => y).Match(x).IsSome).ToProperty();