コード例 #1
0
        public void RunShouldRunTestsInList()
        {
            var testMock = new Mock <ITest>();
            var testList = new TestList(processContextMock.Object);

            testList.AddTest(testMock.Object);
            testList.AddTest(testMock.Object);
            testList.AddTest(testMock.Object);
            testList.Run();
            testMock.Verify(t => t.Run(), Times.Exactly(3));
        }
コード例 #2
0
        public void AddTestFromMetadataShouldAddTestToList()
        {
            var testList = new TestList(processContextMock.Object);

            testList.AddTest(metadata);
            Assert.That(testList.Tests.Count() == 1);
        }
コード例 #3
0
        public void AddTestFromMetadataShouldCreateTestWithMetadata()
        {
            var testList = new TestList(processContextMock.Object);
            var test     = testList.AddTest(metadata);

            Assert.That(test.Metadata == metadata);
        }
コード例 #4
0
        public void AddExisitingTestShouldAddTestToList()
        {
            var testMock = new Mock <ITest>();
            var testList = new TestList(processContextMock.Object);

            testList.AddTest(testMock.Object);
            Assert.That(testList.Tests.Count() == 1);
        }
コード例 #5
0
        public void ClearShouldClearTestsInList()
        {
            var testMock = new Mock <ITest>();
            var testList = new TestList(processContextMock.Object);

            testList.AddTest(testMock.Object);
            testList.Clear();
            testMock.Verify(t => t.Clear());
        }
コード例 #6
0
        public void ClearShouldClearList()
        {
            var testMock = new Mock <ITest>();
            var testList = new TestList(processContextMock.Object);

            testList.AddTest(testMock.Object);
            Assert.That(testList.Tests.Count() == 1);
            testList.Clear();
            Assert.That(!testList.Tests.Any());
        }
コード例 #7
0
        public void AddTestFromTestShouldThrowExceptionWheTestIsNull()
        {
            var testList = new TestList(processContextMock.Object);

            Assert.Throws(Is.InstanceOf <ArgumentNullException>().With.Message.Contains("test"), () => testList.AddTest((ITest)null));
        }
コード例 #8
0
 internal protected void AddTest(ITest test)
 {
     TestList.AddTest(test);
 }
コード例 #9
0
 internal protected ITest AddTest(int testNumber, string testDescription, Action testAction, Action beforeTestAction = null, Action afterTestAction = null, int sleepMillis = 1000)
 {
     return(TestList.AddTest(new DefaultTestMetadata(testNumber, testDescription, testAction, sleepMillis, beforeTestAction, afterTestAction)));
 }