Ejemplo n.º 1
0
 public static ActualValue <string?> IsNullOrEmpty(this ActualValue <string?> expectation) =>
 expectation.Assert(
     string.IsNullOrEmpty(expectation.Value),
     () => new EqualAssertException($""));
Ejemplo n.º 2
0
 public static ActualValue <T> IsNotEqualTo <T>(this ActualValue <T> expectation, T expectedValue, IEqualityComparer <T> comparer) =>
 expectation.Assert(
     !comparer.Equals(expectation.Value, expectedValue),
     () => new EqualAssertException($""));
Ejemplo n.º 3
0
 public static ActualValue <T> And <T>(this ActualValue <T> expectation) => expectation;
Ejemplo n.º 4
0
 public static ActualValue <DateTime> IsEqualTo(this ActualValue <DateTime> expectation, DateTime expectedValue, TimeSpan precision) =>
 expectation.Assert(
     (expectedValue - expectation.Value).Duration() > precision,
     () => new EqualAssertException($""));
Ejemplo n.º 5
0
 public static ActualValue <float> IsEqualTo(this ActualValue <float> expectation, float expectedValue, float precision) =>
 expectation.Assert(
     expectedValue - expectation.Value > precision,
     () => new EqualAssertException($""));
 public static ActualValue <IDictionary <TKey, TValue> > DoesNotContainKey <TKey, TValue>(this ActualValue <IDictionary <TKey, TValue> > expectation, TKey expectedKey) =>
 expectation.Assert(
     !expectation.Value.ContainsKey(expectedKey),
     () => new EqualAssertException($""));
 public static ActualValue <IDictionary <TKey, TValue> > DoesNotHaveLengthOf <TKey, TValue>(this ActualValue <IDictionary <TKey, TValue> > expectation, int expectedLength) =>
 expectation.Assert(
     expectation.Value.Count != expectedLength,
     () => new EqualAssertException($""));
Ejemplo n.º 8
0
 public static ActualValue <string> DoesNotContain(this ActualValue <string> expectation, string expectedValue, StringComparison comparison) =>
 expectation.Assert(
     !expectation.Value.Contains(expectedValue, comparison),
     () => new EqualAssertException($""));
 public static ActualValue <ISet <T> > IsProperSubsetOf <T>(this ActualValue <ISet <T> > expectation, ISet <T> expectedSuperset) =>
 expectation.Assert(
     expectation.Value.IsProperSubsetOf(expectedSuperset),
     () => new EqualAssertException($""));
Ejemplo n.º 10
0
 public static ActualValue <string> Contains(this ActualValue <string> expectation, string expectedValue) =>
 expectation.Assert(
     expectation.Value.Contains(expectedValue),
     () => new EqualAssertException($""));
Ejemplo n.º 11
0
 public static ActualValue <string> StartsWith(this ActualValue <string> expectation, string expectedValue, StringComparison comparison) =>
 expectation.Assert(
     expectation.Value.StartsWith(expectedValue, comparison),
     () => new EqualAssertException($""));
Ejemplo n.º 12
0
 public static ActualValue <string> Matches(this ActualValue <string> expectation, Regex expectedRegex) =>
 expectation.Assert(
     expectedRegex.IsMatch(expectation.Value),
     () => new EqualAssertException($""));
Ejemplo n.º 13
0
 public static ActualValue <string> Matches(this ActualValue <string> expectation, string expectedPattern) =>
 expectation.Assert(
     Regex.IsMatch(expectation.Value, expectedPattern),
     () => new EqualAssertException($""));
Ejemplo n.º 14
0
 public static ActualValue <string?> IsNotNullNorWhitespace(this ActualValue <string?> expectation) =>
 expectation.Assert(
     !string.IsNullOrWhiteSpace(expectation.Value),
     () => new EqualAssertException($""));
 public static ActualValue <IDictionary <TKey, TValue> > Contains <TKey, TValue>(this ActualValue <IDictionary <TKey, TValue> > expectation, TValue expectedValue) =>
 expectation.Assert(
     expectation.Value.Values.Contains(expectedValue, EqualityComparer <TValue> .Default),
     () => new EqualAssertException($""));
 public static ActualValue <T[]> IsNotEmpty <T>(this ActualValue <T[]> expectation) =>
 expectation.Assert(
     expectation.Value.Length != 0,
     () => new EqualAssertException($""));
 public static ActualValue <IDictionary <TKey, TValue> > IsNotEmpty <TKey, TValue>(this ActualValue <IDictionary <TKey, TValue> > expectation) =>
 expectation.Assert(
     expectation.Value.Count != 0,
     () => new EqualAssertException($""));
 public static ActualValue <T[]> DoesNotHaveLengthOf <T>(this ActualValue <T[]> expectation, int expectedLength) =>
 expectation.Assert(
     expectation.Value.Length != expectedLength,
     () => new EqualAssertException($""));
 public static ActualValue <IDictionary <TKey, TValue> > DoesNotContainValue <TKey, TValue>(this ActualValue <IDictionary <TKey, TValue> > expectation, TValue expectedValue, IEqualityComparer <TValue> comparer) =>
 expectation.Assert(
     !expectation.Value.Values.Contains(expectedValue, comparer),
     () => new EqualAssertException($""));
 public static ActualValue <T[]> Contains <T>(this ActualValue <T[]> expectation, T expectedValue) =>
 expectation.Assert(
     Array.IndexOf(expectation.Value, expectedValue) >= 0,
     () => new EqualAssertException($""));
Ejemplo n.º 21
0
 public static ActualValue <decimal> IsEqualTo(this ActualValue <decimal> expectation, decimal expectedValue, decimal precision) =>
 expectation.Assert(
     expectedValue - expectation.Value > precision,
     () => new EqualAssertException($""));
Ejemplo n.º 22
0
 public static ActualValue <ICollection <T> > HasLengthOf <T>(this ActualValue <ICollection <T> > expectation, int expectedLength) =>
 expectation.Assert(
     expectation.Value.Count == expectedLength,
     () => new EqualAssertException($""));
Ejemplo n.º 23
0
 public static ActualValue <bool> IsFalse(this ActualValue <bool> expectation) =>
 expectation.Assert(
Ejemplo n.º 24
0
 public static ActualValue <ICollection <T> > IsNotEmpty <T>(this ActualValue <ICollection <T> > expectation) =>
 expectation.Assert(
     expectation.Value.Count != 0,
     () => new EqualAssertException($""));
Ejemplo n.º 25
0
 public static ActualValue <T> IsEqualTo <T>(this ActualValue <T> expectation, T expectedValue) =>
 expectation.Assert(
     EqualityComparer <T> .Default.Equals(expectation.Value, expectedValue),
     () => new EqualAssertException($""));
Ejemplo n.º 26
0
 public static ActualValue <ICollection <T> > DoesNotContain <T>(this ActualValue <ICollection <T> > expectation, T expectedValue, IEqualityComparer <T> comparer) =>
 expectation.Assert(
     !expectation.Value.Contains(expectedValue, comparer),
     () => new EqualAssertException($""));
Ejemplo n.º 27
0
 public static ActualValue <T> Satisfies <T>(this ActualValue <T> expectation, Func <T, bool> check) =>
 expectation.Assert(
     check(expectation.Value),
     () => new EqualAssertException($""));
Ejemplo n.º 28
0
 public static ActualValue <ICollection <T> > Contains <T>(this ActualValue <ICollection <T> > expectation, T expectedValue) =>
 expectation.Assert(
     expectation.Value.Contains(expectedValue, EqualityComparer <T> .Default),
     () => new EqualAssertException($""));
 public static ActualValue <T> Is <T>(this ActualValue <T> expectation, Type expectedType) =>
 expectation.Assert(
Ejemplo n.º 30
0
 public static ActualValue <string> IsEmpty(this ActualValue <string> expectation) =>
 expectation.Assert(
     expectation.Value.Length == 0,
     () => new EqualAssertException($""));