示例#1
0
 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));
 }
示例#2
0
        public void LengthTest()
        {
            string actual = "afds";

            SAssert.Length(actual, 4);
            XAssert.Throws <ArgumentException>(() => SAssert.Length(actual, 6));
            XAssert.Throws <ArgumentException>(() => SAssert.Length(actual, 2));
        }
示例#3
0
        public void NotNullTest()
        {
            string actual = "afds";

            SAssert.NotNull(actual);

            XAssert.Throws <ArgumentException>(() => SAssert.NotNull(null));
        }
示例#4
0
        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"));
        }
示例#5
0
        public void DefaultStructTest()
        {
            Foo f  = new Foo(32);
            Foo f2 = default(Foo);

            SAssert.NotDefault(f);
            XAssert.Throws <ArgumentException>(() => SAssert.NotDefault(f2));
        }
示例#6
0
        public void NonEqualityTest()
        {
            string actual    = "afds";
            string compared  = "foo";
            string compared2 = "afds";

            SAssert.NotEquals(actual, compared);
            XAssert.Throws <ArgumentException>(() => SAssert.NotEquals(actual, compared2));
        }
示例#7
0
        public void NotEmptyTest()
        {
            string actual = "afds";

            SAssert.NotEmpty(actual);
            SAssert.NotEmpty(null);

            XAssert.Throws <ArgumentException>(() => SAssert.NotEmpty(string.Empty));
        }
示例#8
0
        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));
        }
示例#9
0
        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));
        }
示例#10
0
        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  "));
        }
示例#11
0
        public void EqualityTest()
        {
            long actual   = 32;
            long compared = 32;

            SAssert.Equals(actual, compared);

            long compared2 = 23;

            XAssert.Throws <ArgumentException>(() => SAssert.Equals(actual, compared2));
        }
示例#12
0
        public void FalseTest()
        {
            int actual   = 32;
            int compared = 23;

            SAssert.False(actual == compared);

            int compared2 = 32;

            XAssert.Throws <ArgumentException>(() => SAssert.False(actual == compared2));
        }
示例#13
0
        public void TrueTest()
        {
            int actual   = 32;
            int compared = 32;

            SAssert.True(actual == compared);

            int compared2 = 23;

            XAssert.Throws <ArgumentException>(() => SAssert.True(actual == compared2));
        }
示例#14
0
        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));
        }
示例#15
0
        public void GreaterThanTest()
        {
            int actual   = 32;
            int compared = 23;

            SAssert.GreaterThan(actual, compared);

            int compared2 = 64;

            XAssert.Throws <ArgumentException>(() => SAssert.GreaterThan(actual, compared2));
        }
示例#16
0
        public void LessThanTest()
        {
            int actual   = 23;
            int compared = 32;

            SAssert.LessThan(actual, compared);

            int compared2 = 12;

            XAssert.Throws <ArgumentException>(() => SAssert.LessThan(actual, compared2));
        }
示例#17
0
        public void NonEqualityTest()
        {
            int actual   = 32;
            int compared = 23;

            SAssert.NotEquals(actual, compared);

            int compared2 = 32;

            XAssert.Throws <ArgumentException>(() => SAssert.NotEquals(actual, compared2));
        }
示例#18
0
        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));
        }
示例#19
0
        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));
        }
示例#20
0
        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));
        }
示例#21
0
        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));
        }
示例#22
0
        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));
        }
示例#23
0
 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));
 }
示例#24
0
 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));
 }
示例#25
0
 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));
 }