public void AreElementsNotEqual_fails_when_elements_are_in_different_order()
 {
     AssertionFailure[] failures = Capture(()
                                           => Assert.AreElementsNotEqual(new[] { 1, 2 }, new List <int> {
         1, 2
     }));
     Assert.Count(1, failures);
     Assert.AreEqual("Expected the unexpected and actual sequence to have different elements but all elements were equal.", failures[0].Description);
     Assert.AreEqual("Unexpected Sequence", failures[0].LabeledValues[0].Label);
     Assert.AreEqual("[1, 2]", failures[0].LabeledValues[0].FormattedValue.ToString());
     Assert.AreEqual("Actual Sequence", failures[0].LabeledValues[1].Label);
     Assert.AreEqual("[1, 2]", failures[0].LabeledValues[1].FormattedValue.ToString());
 }
Beispiel #2
0
        public void ResetTest()
        {
            tr.Reset();
            var initRegged = tr.GetRegisteredTasks();
            var task       = new TestTask();

            tr.Register(task);
            var newRegged = tr.GetRegisteredTasks();

            Assert.AreElementsNotEqual(initRegged, newRegged);
            tr.Reset();
            var resetRegged = tr.GetRegisteredTasks();

            Assert.AreElementsNotEqual(resetRegged, newRegged);
            Assert.AreElementsEqualIgnoringOrder(initRegged, resetRegged);
        }
 public void AreElementsNotEqual_with_custom_comparer()
 {
     Assert.AreElementsNotEqual("12", "12", (expected, actual) => expected + 2 == actual);
 }
 public void AreElementsNotEqual_with_different_types()
 {
     Assert.AreElementsNotEqual(new[] { 1, 2 }, new List <int> {
         1, 3
     });
 }
 public void AreElementsNotEqual_with_strings()
 {
     Assert.AreElementsNotEqual("12", "1");
 }
 public void AreElementsNotEqual_fails_with_custom_message()
 {
     AssertionFailure[] failures = Capture(() => Assert.AreElementsNotEqual("2", "2", "{0} message", "custom"));
     Assert.Count(1, failures);
     Assert.AreEqual("custom message", failures[0].Message);
 }
Beispiel #7
0
 public static void ShouldNotBeEquivalentTo <T>(this IEnumerable <T> actual, IEnumerable <T> expected)
 {
     Assert.AreElementsNotEqual(expected, actual);
 }