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); }
public void NotCareIfStructValueChanged() { var testBool = true; AssertAll.IsTrue(testBool); testBool = false; }
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)); } }
public void FailWhenFalse() { AssertAll.IsTrue(1 == 2, "1 and 2 are not the same ya dummy"); Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute()); }
public void PassWhenTrue() { AssertAll.IsTrue(true, "1 and 1 are indeed the same"); AssertAll.Execute(); }
public void ShowAllTheAssertExceptions() { AssertAll.Fail("we'll see the rest in the test results"); AssertAll.IsTrue(false); AssertAll.AreEqual(1, 2); }