Example #1
0
 public ValueAssertionResult AssertValue(T actual)
 {
     return(new ValueAssertionResult(
                expected.IsInstanceOfType(actual),
                actual.ToValueString(),
                ComposeLog.Expected($"of type {expected.Name}")));
 }
Example #2
0
 public ValueAssertionResult AssertValue(DateTime actual)
 {
     return(new ValueAssertionResult(
                actual.Hour == expectedHour,
                actual.ToExasDateTimeString(),
                ComposeLog.Expected($"has hour {expectedHour}")));
 }
Example #3
0
 public ValueAssertionResult AssertValue(DateTime actual)
 {
     return(new ValueAssertionResult(
                actual < expected,
                actual.ToExasDateTimeString(),
                ComposeLog.Expected($"before {expected.ToExasDateTimeString()}")));
 }
Example #4
0
 public ValueAssertionResult AssertValue(DateTime actual)
 {
     return(new ValueAssertionResult(
                actual.Month == expectedMonth,
                actual.ToExasDateString(),
                ComposeLog.Expected($"has month {expectedMonth}")));
 }
Example #5
0
 public ValueAssertionResult AssertValue(DateTime actual)
 {
     return(new ValueAssertionResult(
                actual.Second == expectedSecond,
                actual.ToExasDateTimeString(),
                ComposeLog.Expected($"has second {expectedSecond}")));
 }
Example #6
0
 public ValueAssertionResult AssertValue(T actual)
 {
     return(new ValueAssertionResult(
                min.CompareTo(actual) <= 0 && actual.CompareTo(max) <= 0,
                actual.ToValueString(),
                ComposeLog.Expected($"between {min} and {max}")));
 }
Example #7
0
 public ValueAssertionResult AssertValue(T actual)
 {
     return(new ValueAssertionResult(
                actual.CompareTo(expected) > 0,
                actual.ToString(),
                ComposeLog.Expected($"greater than {expected}")));
 }
Example #8
0
 public ValueAssertionResult AssertValue(DateTime actual)
 {
     return(new ValueAssertionResult(
                actual.Millisecond == expectedMilliseconds,
                actual.ToExasDatetimeStringWithMilliseconds(),
                ComposeLog.Expected($"has millisecond {expectedMilliseconds}")));
 }
Example #9
0
 public ValueAssertionResult AssertValue(TimeSpan actual)
 {
     return(new ValueAssertionResult(
                actual >= default(TimeSpan),
                actual.ToValueString(),
                ComposeLog.Expected("positive")));
 }
Example #10
0
 public ValueAssertionResult AssertValue(IList <T> actual)
 {
     return(new ValueAssertionResult(
                Equal(actual, expected),
                actual.ToValueString(),
                ComposeLog.Expected(expected.ToValueString())));
 }
Example #11
0
 public ValueAssertionResult AssertValue(DateTime actual)
 {
     return(new ValueAssertionResult(
                actual.Year == expected.Year,
                actual.ToExasDateString(),
                ComposeLog.Expected($"in same year as {expected.ToExasDateString()}")));
 }
Example #12
0
 public ValueAssertionResult AssertValue(T actual)
 {
     return(new ValueAssertionResult(
                !Equals(actual, expected),
                actual.ToValueString(),
                ComposeLog.Expected($"not {expected}")));
 }
Example #13
0
 public ValueAssertionResult AssertValue(T actual)
 {
     return(new ValueAssertionResult(
                actual.Compare_NullAware(expected) <= 0,
                actual.ToValueString(),
                ComposeLog.Expected($"less or equal to {expected.ToValueString()}")));
 }
Example #14
0
 public ValueAssertionResult AssertValue(DateTime actual)
 {
     return(new ValueAssertionResult(
                actual.Minute == expectedMinute,
                actual.ToExasDateTimeString(),
                ComposeLog.Expected($"has minute {expectedMinute}")));
 }
Example #15
0
 public ValueAssertionResult AssertValue(DateTime actual)
 {
     return(new ValueAssertionResult(
                actual.Day == expectedDay,
                actual.ToExasDateString(),
                ComposeLog.Expected($"has day {expectedDay}")));
 }
Example #16
0
 public ValueAssertionResult AssertValue(T actual)
 {
     return(new ValueAssertionResult(
                Equals(expected, actual),
                actual.ToValueString(),
                ComposeLog.Expected(expected.ToValueString())));
 }
Example #17
0
 public ValueAssertionResult AssertValue(DateTime actual)
 {
     return(new ValueAssertionResult(
                actual.Date == expected.Date,
                actual.ToExasDateString(),
                ComposeLog.Expected($"on same day as {expected.ToExasDateString()}")));
 }
Example #18
0
 public ValueAssertionResult AssertValue(string actual)
 {
     return(ValueAssertionResult.Create(
                string.Equals(actual, expected),
                HarmonizeLineCount(
                    actual.ToValueString(),
                    ComposeLog.Expected(expected.ToValueString()))));
 }
Example #19
0
 public ValueAssertionResult AssertValue(string actual)
 {
     return(ValueAssertionResult.Create(
                actual.Contains_NullAware(expected),
                HarmonizeLineCount(
                    actual.ToValueString(),
                    ComposeLog.Expected($"contains {expected.ToValueString()}"))));
 }
Example #20
0
 public ValueAssertionResult AssertValue(string actual)
 {
     return(ValueAssertionResult.Create(
                !actual.StartsWith(expected),
                HarmonizeLineCount(
                    actual.ToValueString(),
                    ComposeLog.Expected($"doesn't start with '{expected}'"))));
 }
Example #21
0
 public ValueAssertionResult AssertValue(string actual)
 {
     return(ValueAssertionResult.Create(
                actual != string.Empty,
                HarmonizeLineCount(
                    actual.ToValueString(),
                    ComposeLog.Expected("not empty"))));
 }
Example #22
0
 public ValueAssertionResult AssertValue(string actual)
 {
     return(ValueAssertionResult.Create(
                actual?.Length == expected,
                HarmonizeLineCount(
                    $"{actual.ToValueString()}[{actual?.Length ?? 0}]",
                    ComposeLog.Expected($"length {expected}"))));
 }
Example #23
0
        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);
        }
Example #24
0
        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);
        }
Example #25
0
        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")));
        }
Example #27
0
        public ValueAssertionResult AssertValue(IEnumerable <T> actual)
        {
            var actualList = actual.ToReadOnly();

            return(new ValueAssertionResult(
                       Equivalent(actualList, expected),
                       actualList.ToValueString(),
                       ComposeLog.Expected($"equivalent to {expected.ToValueString()}")));
        }
Example #28
0
        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);
        }
Example #29
0
        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);
        }
Example #30
0
        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()}")));
        }