public void CountRangeTest() { int[] a = new int[] { 1, 2, 3, 5, 7, 8, 10 }; SAssert.Count(a, 2, 4, x => x > 3); XAssert.Throws <ArgumentException>(() => SAssert.Count(a, 3, 5, x => x > 7)); XAssert.Throws <ArgumentException>(() => SAssert.Count(a, 3, 5, x => x > 1)); }
public void LengthTest() { string actual = "afds"; SAssert.Length(actual, 4); XAssert.Throws <ArgumentException>(() => SAssert.Length(actual, 6)); XAssert.Throws <ArgumentException>(() => SAssert.Length(actual, 2)); }
public void NotNullTest() { string actual = "afds"; SAssert.NotNull(actual); XAssert.Throws <ArgumentException>(() => SAssert.NotNull(null)); }
public void DictionaryTest() { Dictionary <string, string> a = new Dictionary <string, string>(); a.Add("foo", "bar"); SAssert.ContainsKey(a, "foo"); XAssert.Throws <ArgumentException>(() => SAssert.ContainsKey(a, "loo")); }
public void DefaultStructTest() { Foo f = new Foo(32); Foo f2 = default(Foo); SAssert.NotDefault(f); XAssert.Throws <ArgumentException>(() => SAssert.NotDefault(f2)); }
public void NonEqualityTest() { string actual = "afds"; string compared = "foo"; string compared2 = "afds"; SAssert.NotEquals(actual, compared); XAssert.Throws <ArgumentException>(() => SAssert.NotEquals(actual, compared2)); }
public void NotEmptyTest() { string actual = "afds"; SAssert.NotEmpty(actual); SAssert.NotEmpty(null); XAssert.Throws <ArgumentException>(() => SAssert.NotEmpty(string.Empty)); }
public void WildcardTest() { string actual = "foo123.txt"; string pattern = "foo*.txt"; string pattern2 = "bar*.txt"; SAssert.IsLike(actual, pattern); XAssert.Throws <ArgumentException>(() => SAssert.IsLike(actual, pattern2)); }
public void RegexTest() { string actual = "1~~5~~4"; string actual2 = "a~~b~~c"; string pattern = "[0-9]~~[0-9]~~[0-9]"; SAssert.IsMatch(actual, pattern); XAssert.Throws <ArgumentException>(() => SAssert.IsMatch(actual2, pattern)); }
public void NotNullOrWhiteSpaceTest() { string actual = "afds"; SAssert.NotNullOrWhiteSpace(actual); XAssert.Throws <ArgumentException>(() => SAssert.NotNullOrWhiteSpace(null)); XAssert.Throws <ArgumentException>(() => SAssert.NotNullOrWhiteSpace(string.Empty)); XAssert.Throws <ArgumentException>(() => SAssert.NotNullOrWhiteSpace(" \t ")); }
public void EqualityTest() { long actual = 32; long compared = 32; SAssert.Equals(actual, compared); long compared2 = 23; XAssert.Throws <ArgumentException>(() => SAssert.Equals(actual, compared2)); }
public void FalseTest() { int actual = 32; int compared = 23; SAssert.False(actual == compared); int compared2 = 32; XAssert.Throws <ArgumentException>(() => SAssert.False(actual == compared2)); }
public void TrueTest() { int actual = 32; int compared = 32; SAssert.True(actual == compared); int compared2 = 23; XAssert.Throws <ArgumentException>(() => SAssert.True(actual == compared2)); }
public void EmptyArrayTest() { int[] a = new int[] { 1, 2, 3 }; int[] b = new int[] { }; SAssert.NotEmpty(a); XAssert.Throws <ArgumentException>(() => SAssert.NotEmpty(b)); SAssert.Empty(b); XAssert.Throws <ArgumentException>(() => SAssert.Empty(a)); }
public void GreaterThanTest() { int actual = 32; int compared = 23; SAssert.GreaterThan(actual, compared); int compared2 = 64; XAssert.Throws <ArgumentException>(() => SAssert.GreaterThan(actual, compared2)); }
public void LessThanTest() { int actual = 23; int compared = 32; SAssert.LessThan(actual, compared); int compared2 = 12; XAssert.Throws <ArgumentException>(() => SAssert.LessThan(actual, compared2)); }
public void NonEqualityTest() { int actual = 32; int compared = 23; SAssert.NotEquals(actual, compared); int compared2 = 32; XAssert.Throws <ArgumentException>(() => SAssert.NotEquals(actual, compared2)); }
public void LessThanOrEqualsTest() { int actual = 32; int compared = 64; int compared2 = 32; SAssert.LessThanOrEqualsTo(actual, compared); SAssert.LessThanOrEqualsTo(actual, compared2); int compared3 = 12; XAssert.Throws <ArgumentException>(() => SAssert.LessThanOrEqualsTo(actual, compared3)); }
public void GreaterThanOrEqualsTest() { long actual = 32; long compared = 23; long compared2 = 32; SAssert.GreaterThanOrEqualsTo(actual, compared); SAssert.GreaterThanOrEqualsTo(actual, compared2); int compared3 = 64; XAssert.Throws <ArgumentException>(() => SAssert.GreaterThan(actual, compared3)); }
public void EmptyDictionaryTest() { Dictionary <string, string> a = new Dictionary <string, string>(); a.Add("foo", "bar"); Dictionary <string, string> b = new Dictionary <string, string>(); SAssert.NotEmpty(a); XAssert.Throws <ArgumentException>(() => SAssert.NotEmpty(b)); SAssert.Empty(b); XAssert.Throws <ArgumentException>(() => SAssert.Empty(a)); }
public void EmptyListTest() { List <string> a = new List <string>(); a.Add("foo"); List <string> b = new List <string>(); SAssert.NotEmpty(a); XAssert.Throws <ArgumentException>(() => SAssert.NotEmpty(b)); SAssert.Empty(b); XAssert.Throws <ArgumentException>(() => SAssert.Empty(a)); }
public void BetweenTest() { int actual = 32; int lower = 20; int higher = 100; SAssert.Between(actual, lower, higher); int actual2 = 5; int actual3 = 200; XAssert.Throws <ArgumentException>(() => SAssert.Between(actual2, lower, higher)); XAssert.Throws <ArgumentException>(() => SAssert.Between(actual3, lower, higher)); }
public void CountMaxTest() { int[] a = new int[] { 1, 2, 3, 5, 7 }; SAssert.MaxCount(a, 3, x => x < 3); XAssert.Throws <ArgumentException>(() => SAssert.MaxCount(a, 2, x => x > 2)); }
public void CountTest() { int[] a = new int[] { 1, 2, 3 }; SAssert.Count(a, 2, x => x < 3); XAssert.Throws <ArgumentException>(() => SAssert.Count(a, 3, x => x < 3)); }
public void AllPredicateTest() { int[] a = new int[] { 1, 2, 3 }; SAssert.All(a, x => x < 5); XAssert.Throws <ArgumentException>(() => SAssert.All(a, x => x < 2)); }