public void FailWhenInnerExceptionIsNull() { AssertAll.ThrowsExceptionWithInnerException <ArgumentException>(() => throw new Exception(RandomValue.String())); Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute()); }
public void FailWhenThereAreFailures() { AssertAll.IsFalse(false); AssertAll.Inconclusive(); AssertAll.Fail(); Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute()); }
public void PassWhenInnerExceptionIsOfCorrectType() { AssertAll.ThrowsExceptionWithInnerExceptionAsync <InvalidOperationException>(async() => await ThrowExceptionWithInnerInvalidOperationException(true)); AssertAll.Execute(); }
public void FailWhenInnerExceptionIsNotCorrectType() { AssertAll.ThrowsExceptionWithInnerExceptionAsync <ArgumentException>(async() => await ThrowExceptionWithInnerInvalidOperationException(true)); Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute()); }
public void FailWhenInnerExceptionIsNull() { AssertAll.ThrowsExceptionWithInnerExceptionAsync <ArgumentException>(async() => await ThrowNewException()); Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute()); }
public void PassWhenThereAreNoExceptionsOrInconclusives() { AssertAll.IsFalse(false); AssertAll.AreEqual(1, 1); AssertAll.IsInstanceOfType(1, typeof(int)); AssertAll.Execute(); }
public void ThrowAssertInconclusiveExceptionWhenInconclusive() { AssertAll.IsFalse(false); AssertAll.AreEqual(1, 1); AssertAll.Inconclusive(); Assert.ThrowsException <AssertAllInconclusiveException>(() => AssertAll.Execute()); }
public void PassWhenDifferentReferences() { var object1 = new object(); var object2 = new object(); AssertAll.AreNotSame(object1, object2, "these are the same"); AssertAll.Execute(); }
public void PassWhenSameReferences() { var object1 = new object(); var object2 = object1; AssertAll.AreSame(object1, object2, "these are not the same"); AssertAll.Execute(); }
public void PassWhenExceptionOfCorrectTypeIsThrown() { var emptyList = new List <object>(); AssertAll.ThrowsException <InvalidOperationException>(() => emptyList.Single()); AssertAll.Execute(); }
public void FailWhenWrongExceptionIsThrown() { var emptyList = new List <object>(); AssertAll.ThrowsException <NullReferenceException>(() => emptyList.Single()); Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute()); }
public void PassWhenStartsWIth() { var start = RandomValue.String(); var end = RandomValue.String(); AssertAll.Strings.StartsWith($"{start}{end}", start); AssertAll.Execute(); }
public void FailWhenValueDoesNotEndsWithSubstring() { var value = RandomValue.String(); var substring = RandomValue.String(); AssertAll.Strings.EndsWith(value, substring); Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute()); }
public void PassWhenValueEndsWithSubstring() { var start = RandomValue.String(); var end = RandomValue.String(); AssertAll.Strings.EndsWith($"{start}{end}", end); AssertAll.Execute(); }
public void PassWhenDoesNotMatch() { var someString = RandomValue.Int().ToString(); var pattern = new Regex("[a-z]"); AssertAll.Strings.DoesNotMatch(someString, pattern); AssertAll.Execute(); }
public void PassWhenLogicallyEqualButDifferentTypes() { int expected = 1; long actual = 1; AssertAll.AreNotEqual(expected, actual, "the types are different"); AssertAll.Execute(); }
public void PassWhenMatches() { var someString = RandomValue.Int().ToString(); var pattern = new Regex("[0-9]"); AssertAll.Strings.Matches(someString, pattern); AssertAll.Execute(); }
public void PassWhenDoesContain() { var list1 = new List <string> { "1", "2" }; AssertAll.Collections.Contains(list1, "2"); AssertAll.Execute(); }
public void PassWhenExceptionMethodEqualsArgument() { var message = RandomValue.String(); AssertAll.ExceptionMessageEquals(() => ThrowExceptionWithMessage(message), message); AssertAll.Execute(); }
public void FailWhenLogicallyEqualButDifferentTypes() { int expected = 1; long actual = 1; AssertAll.AreEqual(expected, actual, "the types are different"); Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute()); }
public void FailWhenSameReference() { var object1 = new object(); var object2 = object1; AssertAll.AreNotSame(object1, object2, "these are the same"); Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute()); }
public void FailWhenDifferentReferences() { var object1 = new object(); var object2 = new object(); AssertAll.AreSame(object1, object2, "these are not the same"); Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute()); }
public void PassWhenChildType() { var list1 = new List <ChildType> { new ChildType() }; AssertAll.Collections.AllItemsAreInstancesOfType(list1, typeof(ParentType)); AssertAll.Execute(); }
public void FailWhenDoesNotStartWith() { var value = RandomValue.String(); var differentValue = RandomValue.String(); AssertAll.Strings.StartsWith(value, differentValue); Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute()); }
public void FailWhenDoesNotMatch() { var someString = RandomValue.Int().ToString(); var pattern = new Regex("[a-z]"); AssertAll.Strings.Matches(someString, pattern); Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute()); }
public void PassWhenOfType() { var list1 = new List <string> { "1", "2" }; AssertAll.Collections.AllItemsAreInstancesOfType(list1, typeof(string)); AssertAll.Execute(); }
public void PassWhenNoItemIsNull() { var list1 = new List <string> { "1", "2" }; AssertAll.Collections.AllItemsAreNotNull(list1); AssertAll.Execute(); }
public void PassWhenItemsAreUnique() { var list1 = new List <string> { "1", "2" }; AssertAll.Collections.AllItemsAreUnique(list1); AssertAll.Execute(); }
public void FailWhenExceptionIsNotThrown() { var notEqual = RandomValue.String(); var message = RandomValue.String(); AssertAll.ExceptionMessageContains(() => ThrowExceptionWithMessage(message, false), notEqual); Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute()); }
public void FailWhenExceptionMessageDoesNotContainArgument() { var doesNotContain = RandomValue.String(); var message = RandomValue.String(); AssertAll.ExceptionMessageContains(() => ThrowExceptionWithMessage(message), doesNotContain); Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute()); }