Esempio n. 1
0
 public static ActualValue <string> Equals(this ActualValue <string> expectation, string expectedValue, StringComparison comparison) =>
 expectation.Assert(
     string.Equals(expectedValue, expectation.Value, comparison),
     () => new EqualAssertException($""));
Esempio n. 2
0
 public static ActualValue <float> IsEqualTo(this ActualValue <float> expectation, float expectedValue, float precision) =>
 expectation.Assert(
     expectedValue - expectation.Value > precision,
     () => new EqualAssertException($""));
Esempio n. 3
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($""));
 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($""));
Esempio n. 5
0
 public static ActualValue <decimal> IsEqualTo(this ActualValue <decimal> expectation, decimal expectedValue, decimal precision) =>
 expectation.Assert(
     expectedValue - expectation.Value > precision,
     () => new EqualAssertException($""));
Esempio n. 6
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 <IDictionary <TKey, TValue> > IsNotEmpty <TKey, TValue>(this ActualValue <IDictionary <TKey, TValue> > expectation) =>
 expectation.Assert(
     expectation.Value.Count != 0,
     () => new EqualAssertException($""));
Esempio n. 8
0
 public static ActualValue <string> Matches(this ActualValue <string> expectation, Regex expectedRegex) =>
 expectation.Assert(
     expectedRegex.IsMatch(expectation.Value),
     () => new EqualAssertException($""));
Esempio n. 9
0
 public static ActualValue <string> Contains(this ActualValue <string> expectation, string expectedValue) =>
 expectation.Assert(
     expectation.Value.Contains(expectedValue),
     () => new EqualAssertException($""));
Esempio n. 10
0
 public static ActualValue <string?> IsNotNullNorWhitespace(this ActualValue <string?> expectation) =>
 expectation.Assert(
     !string.IsNullOrWhiteSpace(expectation.Value),
     () => new EqualAssertException($""));
Esempio n. 11
0
 public static ActualValue <string> Matches(this ActualValue <string> expectation, string expectedPattern) =>
 expectation.Assert(
     Regex.IsMatch(expectation.Value, expectedPattern),
     () => new EqualAssertException($""));
Esempio n. 12
0
 public static ActualValue <string?> IsNullOrEmpty(this ActualValue <string?> expectation) =>
 expectation.Assert(
     string.IsNullOrEmpty(expectation.Value),
     () => new EqualAssertException($""));
Esempio n. 13
0
 public static ActualValue <string> IsEmpty(this ActualValue <string> expectation) =>
 expectation.Assert(
     expectation.Value.Length == 0,
     () => new EqualAssertException($""));
Esempio n. 14
0
 public static ActualValue <string> HasLengthOf(this ActualValue <string> expectation, int expectedLength) =>
 expectation.Assert(
     expectation.Value.Length == expectedLength,
     () => new EqualAssertException($""));
Esempio n. 15
0
 public static ActualValue <ICollection <T> > IsNotEmpty <T>(this ActualValue <ICollection <T> > expectation) =>
 expectation.Assert(
     expectation.Value.Count != 0,
     () => new EqualAssertException($""));
Esempio n. 16
0
 public static ActualValue <string> StartsWith(this ActualValue <string> expectation, string expectedValue, StringComparison comparison) =>
 expectation.Assert(
     expectation.Value.StartsWith(expectedValue, comparison),
     () => new EqualAssertException($""));
Esempio n. 17
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($""));
Esempio n. 18
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 <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 <ISet <T> > IsProperSubsetOf <T>(this ActualValue <ISet <T> > expectation, ISet <T> expectedSuperset) =>
 expectation.Assert(
     expectation.Value.IsProperSubsetOf(expectedSuperset),
     () => 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 <T[]> IsNotEmpty <T>(this ActualValue <T[]> expectation) =>
 expectation.Assert(
     expectation.Value.Length != 0,
     () => 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($""));
 public static ActualValue <T[]> DoesNotHaveLengthOf <T>(this ActualValue <T[]> expectation, int expectedLength) =>
 expectation.Assert(
     expectation.Value.Length != expectedLength,
     () => new EqualAssertException($""));
Esempio n. 25
0
 public static ActualValue <DateTime> IsEqualTo(this ActualValue <DateTime> expectation, DateTime expectedValue, TimeSpan precision) =>
 expectation.Assert(
     (expectedValue - expectation.Value).Duration() > precision,
     () => new EqualAssertException($""));
 public static ActualValue <T[]> Contains <T>(this ActualValue <T[]> expectation, T expectedValue) =>
 expectation.Assert(
     Array.IndexOf(expectation.Value, expectedValue) >= 0,
     () => new EqualAssertException($""));
Esempio n. 27
0
 public static ActualValue <T> IsEqualTo <T>(this ActualValue <T> expectation, T expectedValue) =>
 expectation.Assert(
     EqualityComparer <T> .Default.Equals(expectation.Value, expectedValue),
     () => new EqualAssertException($""));
Esempio n. 28
0
 public static ActualValue <ICollection <T> > HasLengthOf <T>(this ActualValue <ICollection <T> > expectation, int expectedLength) =>
 expectation.Assert(
     expectation.Value.Count == expectedLength,
     () => new EqualAssertException($""));
Esempio n. 29
0
 public static ActualValue <T> Satisfies <T>(this ActualValue <T> expectation, Func <T, bool> check) =>
 expectation.Assert(
     check(expectation.Value),
     () => new EqualAssertException($""));
Esempio n. 30
0
 public static ActualValue <string> EndsWith(this ActualValue <string> expectation, string expectedValue) =>
 expectation.Assert(
     expectation.Value.EndsWith(expectedValue, StringComparison.OrdinalIgnoreCase),
     () => new EqualAssertException($""));