Example #1
0
        public void ThrowExceptionIfNotUsingAssertAllAttribute()
        {
            var exception = Assert.ThrowsException <InvalidOperationException>(() =>
                                                                               AssertAll.IsTrue(true));

            Assert.AreEqual("AssertAll statements can only be used in a test with the AssertAllTestMethod attribute", exception.Message);
        }
Example #2
0
        public void NotCareIfStructValueChanged()
        {
            var testBool = true;

            AssertAll.IsTrue(testBool);
            testBool = false;
        }
Example #3
0
        public void AllFailureAndInconclusiveMessagesAreIncluded()
        {
            var message1 = RandomValue.String();
            var message2 = RandomValue.String();
            var message3 = RandomValue.String();

            AssertAll.IsTrue(true, message1);
            AssertAll.Fail(message2);
            AssertAll.Inconclusive(message3);

            try
            {
                AssertAll.Execute();
            }
            catch (Exception e)
            {
                var message = e.Message;
                Assert.IsFalse(message.Contains(message1));
                Assert.IsTrue(message.Contains(message2));
                Assert.IsTrue(message.Contains(message3));
            }
        }
Example #4
0
        public void FailWhenFalse()
        {
            AssertAll.IsTrue(1 == 2, "1 and 2 are not the same ya dummy");

            Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute());
        }
Example #5
0
        public void PassWhenTrue()
        {
            AssertAll.IsTrue(true, "1 and 1 are indeed the same");

            AssertAll.Execute();
        }
Example #6
0
 public void ShowAllTheAssertExceptions()
 {
     AssertAll.Fail("we'll see the rest in the test results");
     AssertAll.IsTrue(false);
     AssertAll.AreEqual(1, 2);
 }