Esempio n. 1
0
        public void FailWhenInnerExceptionIsNull()
        {
            AssertAll.ThrowsExceptionWithInnerException <ArgumentException>(() =>
                                                                            throw new Exception(RandomValue.String()));

            Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute());
        }
Esempio n. 2
0
 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());
        }
Esempio n. 6
0
 public void PassWhenThereAreNoExceptionsOrInconclusives()
 {
     AssertAll.IsFalse(false);
     AssertAll.AreEqual(1, 1);
     AssertAll.IsInstanceOfType(1, typeof(int));
     AssertAll.Execute();
 }
Esempio n. 7
0
 public void ThrowAssertInconclusiveExceptionWhenInconclusive()
 {
     AssertAll.IsFalse(false);
     AssertAll.AreEqual(1, 1);
     AssertAll.Inconclusive();
     Assert.ThrowsException <AssertAllInconclusiveException>(() => AssertAll.Execute());
 }
Esempio n. 8
0
        public void PassWhenDifferentReferences()
        {
            var object1 = new object();
            var object2 = new object();

            AssertAll.AreNotSame(object1, object2, "these are the same");
            AssertAll.Execute();
        }
Esempio n. 9
0
        public void PassWhenSameReferences()
        {
            var object1 = new object();
            var object2 = object1;

            AssertAll.AreSame(object1, object2, "these are not the same");
            AssertAll.Execute();
        }
Esempio n. 10
0
        public void PassWhenExceptionOfCorrectTypeIsThrown()
        {
            var emptyList = new List <object>();

            AssertAll.ThrowsException <InvalidOperationException>(() => emptyList.Single());

            AssertAll.Execute();
        }
Esempio n. 11
0
        public void FailWhenWrongExceptionIsThrown()
        {
            var emptyList = new List <object>();

            AssertAll.ThrowsException <NullReferenceException>(() => emptyList.Single());

            Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute());
        }
Esempio n. 12
0
        public void PassWhenStartsWIth()
        {
            var start = RandomValue.String();
            var end   = RandomValue.String();

            AssertAll.Strings.StartsWith($"{start}{end}", start);

            AssertAll.Execute();
        }
Esempio n. 13
0
        public void FailWhenValueDoesNotEndsWithSubstring()
        {
            var value     = RandomValue.String();
            var substring = RandomValue.String();

            AssertAll.Strings.EndsWith(value, substring);

            Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute());
        }
Esempio n. 14
0
        public void PassWhenValueEndsWithSubstring()
        {
            var start = RandomValue.String();
            var end   = RandomValue.String();

            AssertAll.Strings.EndsWith($"{start}{end}", end);

            AssertAll.Execute();
        }
Esempio n. 15
0
        public void PassWhenDoesNotMatch()
        {
            var someString = RandomValue.Int().ToString();
            var pattern    = new Regex("[a-z]");

            AssertAll.Strings.DoesNotMatch(someString, pattern);

            AssertAll.Execute();
        }
Esempio n. 16
0
        public void PassWhenLogicallyEqualButDifferentTypes()
        {
            int  expected = 1;
            long actual   = 1;

            AssertAll.AreNotEqual(expected, actual, "the types are different");

            AssertAll.Execute();
        }
Esempio n. 17
0
        public void PassWhenMatches()
        {
            var someString = RandomValue.Int().ToString();
            var pattern    = new Regex("[0-9]");

            AssertAll.Strings.Matches(someString, pattern);

            AssertAll.Execute();
        }
Esempio n. 18
0
        public void PassWhenDoesContain()
        {
            var list1 = new List <string> {
                "1", "2"
            };

            AssertAll.Collections.Contains(list1, "2");
            AssertAll.Execute();
        }
Esempio n. 19
0
        public void PassWhenExceptionMethodEqualsArgument()
        {
            var message = RandomValue.String();

            AssertAll.ExceptionMessageEquals(() => ThrowExceptionWithMessage(message),
                                             message);

            AssertAll.Execute();
        }
Esempio n. 20
0
        public void FailWhenLogicallyEqualButDifferentTypes()
        {
            int  expected = 1;
            long actual   = 1;

            AssertAll.AreEqual(expected, actual, "the types are different");

            Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute());
        }
Esempio n. 21
0
        public void FailWhenSameReference()
        {
            var object1 = new object();
            var object2 = object1;

            AssertAll.AreNotSame(object1, object2, "these are the same");

            Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute());
        }
Esempio n. 22
0
        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();
        }
Esempio n. 24
0
        public void FailWhenDoesNotStartWith()
        {
            var value          = RandomValue.String();
            var differentValue = RandomValue.String();

            AssertAll.Strings.StartsWith(value, differentValue);

            Assert.ThrowsException <AssertAllFailedException>(() => AssertAll.Execute());
        }
Esempio n. 25
0
        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();
        }
Esempio n. 27
0
        public void PassWhenNoItemIsNull()
        {
            var list1 = new List <string> {
                "1", "2"
            };

            AssertAll.Collections.AllItemsAreNotNull(list1);
            AssertAll.Execute();
        }
Esempio n. 28
0
        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());
        }