public ValueAssertionResult AssertValue(T actual) { return(new ValueAssertionResult( expected.IsInstanceOfType(actual), actual.ToValueString(), ComposeLog.Expected($"of type {expected.Name}"))); }
public ValueAssertionResult AssertValue(DateTime actual) { return(new ValueAssertionResult( actual.Hour == expectedHour, actual.ToExasDateTimeString(), ComposeLog.Expected($"has hour {expectedHour}"))); }
public ValueAssertionResult AssertValue(DateTime actual) { return(new ValueAssertionResult( actual < expected, actual.ToExasDateTimeString(), ComposeLog.Expected($"before {expected.ToExasDateTimeString()}"))); }
public ValueAssertionResult AssertValue(DateTime actual) { return(new ValueAssertionResult( actual.Month == expectedMonth, actual.ToExasDateString(), ComposeLog.Expected($"has month {expectedMonth}"))); }
public ValueAssertionResult AssertValue(DateTime actual) { return(new ValueAssertionResult( actual.Second == expectedSecond, actual.ToExasDateTimeString(), ComposeLog.Expected($"has second {expectedSecond}"))); }
public ValueAssertionResult AssertValue(T actual) { return(new ValueAssertionResult( min.CompareTo(actual) <= 0 && actual.CompareTo(max) <= 0, actual.ToValueString(), ComposeLog.Expected($"between {min} and {max}"))); }
public ValueAssertionResult AssertValue(T actual) { return(new ValueAssertionResult( actual.CompareTo(expected) > 0, actual.ToString(), ComposeLog.Expected($"greater than {expected}"))); }
public ValueAssertionResult AssertValue(DateTime actual) { return(new ValueAssertionResult( actual.Millisecond == expectedMilliseconds, actual.ToExasDatetimeStringWithMilliseconds(), ComposeLog.Expected($"has millisecond {expectedMilliseconds}"))); }
public ValueAssertionResult AssertValue(TimeSpan actual) { return(new ValueAssertionResult( actual >= default(TimeSpan), actual.ToValueString(), ComposeLog.Expected("positive"))); }
public ValueAssertionResult AssertValue(IList <T> actual) { return(new ValueAssertionResult( Equal(actual, expected), actual.ToValueString(), ComposeLog.Expected(expected.ToValueString()))); }
public ValueAssertionResult AssertValue(DateTime actual) { return(new ValueAssertionResult( actual.Year == expected.Year, actual.ToExasDateString(), ComposeLog.Expected($"in same year as {expected.ToExasDateString()}"))); }
public ValueAssertionResult AssertValue(T actual) { return(new ValueAssertionResult( !Equals(actual, expected), actual.ToValueString(), ComposeLog.Expected($"not {expected}"))); }
public ValueAssertionResult AssertValue(T actual) { return(new ValueAssertionResult( actual.Compare_NullAware(expected) <= 0, actual.ToValueString(), ComposeLog.Expected($"less or equal to {expected.ToValueString()}"))); }
public ValueAssertionResult AssertValue(DateTime actual) { return(new ValueAssertionResult( actual.Minute == expectedMinute, actual.ToExasDateTimeString(), ComposeLog.Expected($"has minute {expectedMinute}"))); }
public ValueAssertionResult AssertValue(DateTime actual) { return(new ValueAssertionResult( actual.Day == expectedDay, actual.ToExasDateString(), ComposeLog.Expected($"has day {expectedDay}"))); }
public ValueAssertionResult AssertValue(T actual) { return(new ValueAssertionResult( Equals(expected, actual), actual.ToValueString(), ComposeLog.Expected(expected.ToValueString()))); }
public ValueAssertionResult AssertValue(DateTime actual) { return(new ValueAssertionResult( actual.Date == expected.Date, actual.ToExasDateString(), ComposeLog.Expected($"on same day as {expected.ToExasDateString()}"))); }
public ValueAssertionResult AssertValue(string actual) { return(ValueAssertionResult.Create( string.Equals(actual, expected), HarmonizeLineCount( actual.ToValueString(), ComposeLog.Expected(expected.ToValueString())))); }
public ValueAssertionResult AssertValue(string actual) { return(ValueAssertionResult.Create( actual.Contains_NullAware(expected), HarmonizeLineCount( actual.ToValueString(), ComposeLog.Expected($"contains {expected.ToValueString()}")))); }
public ValueAssertionResult AssertValue(string actual) { return(ValueAssertionResult.Create( !actual.StartsWith(expected), HarmonizeLineCount( actual.ToValueString(), ComposeLog.Expected($"doesn't start with '{expected}'")))); }
public ValueAssertionResult AssertValue(string actual) { return(ValueAssertionResult.Create( actual != string.Empty, HarmonizeLineCount( actual.ToValueString(), ComposeLog.Expected("not empty")))); }
public ValueAssertionResult AssertValue(string actual) { return(ValueAssertionResult.Create( actual?.Length == expected, HarmonizeLineCount( $"{actual.ToValueString()}[{actual?.Length ?? 0}]", ComposeLog.Expected($"length {expected}")))); }
public void OnEqualsNull_WithNull_ShouldReturnSuccess() { EqualAssertion assertion = EqualAssertion(null); ValueAssertionResult result = assertion.AssertValue(null); Assert.AreEqual("null", result.actualValueString); Assert.AreEqual(ComposeLog.Expected("null"), result.expectationString); Assert.IsTrue(result.succeeded); }
public void OnEqualsStringy_WithNull_ShouldReturnFailure() { EqualAssertion assertion = EqualAssertion("Stringy"); ValueAssertionResult result = assertion.AssertValue(null); Assert.AreEqual("null", result.actualValueString); Assert.AreEqual(ComposeLog.Expected("'Stringy'"), result.expectationString); Assert.IsFalse(result.succeeded); }
public void OnEqualsStringy_WithStringy_ShouldReturnSuccess() { EqualAssertion assertion = EqualAssertion("Stringy"); ValueAssertionResult result = assertion.AssertValue("Stringy"); Assert.AreEqual("'Stringy'", result.actualValueString); Assert.AreEqual(ComposeLog.Expected("'Stringy'"), result.expectationString); Assert.IsTrue(result.succeeded); }
public void ExpectingNull_OnNaruto_ShouldSucceed() { // act var result = Naruto().Evaluate(n => n.Member(x => x.Name).DoesntContain(null)); // assert result.ExAssert(r => r.Member(x => x.succeeded).IsTrue() .Member(x => x.expectation).IsEqualTo(ComposeLog.Expected("doesn't contain null"))); }
public ValueAssertionResult AssertValue(IEnumerable <T> actual) { var actualList = actual.ToReadOnly(); return(new ValueAssertionResult( Equivalent(actualList, expected), actualList.ToValueString(), ComposeLog.Expected($"equivalent to {expected.ToValueString()}"))); }
public void WithNull_ShouldReturnSuccess() { var assertion = IsNotEmptyAssertion(); var result = assertion.AssertValue(null); Assert.AreEqual("null", result.actualValueString); Assert.AreEqual(ComposeLog.Expected("not empty"), result.expectationString); Assert.IsTrue(result.succeeded); }
public void OnFalse_ShouldFail() { var assertion = new IsTrueAssertion(); ValueAssertionResult result = assertion.AssertValue(false); Assert.AreEqual("False", result.actualValueString); Assert.AreEqual(ComposeLog.Expected("True"), result.expectationString); Assert.IsFalse(result.succeeded); }
public ValueAssertionResult AssertValue(IEnumerable <TItem> actual) { var actualList = actual?.ToList(); return(new ValueAssertionResult( !actualList.ContainsAny_NullAware(expectedItems), actualList.ToValueString(), ComposeLog.Expected($"doesn't contain {expectedItems.ToValueString()}"))); }