예제 #1
0
        public void MismatchedTypeAddTestBlockParamsAndExecuteArgsFails()
        {
            TestBuilder builder = new TestBuilder();

            builder.AddTestBlock <ExampleTestBlockWithExecuteArg>(1234);

            Assert.Throws <TestCaseException>(() => builder.ExecuteTestCase());
        }
예제 #2
0
        public void PassExecuteArgumentsViaAddTestBlockParams()
        {
            TestBuilder builder = new TestBuilder();

            builder
            .AddTestBlock <ExampleTestBlockWithExecuteArg>("Testing")
            .ExecuteTestCase();
        }
예제 #3
0
        public void AddFinallyBlockDoesNotThrowIfExceptionOccursInFinally()
        {
            TestBuilder builder = new TestBuilder();

            builder
            .AddTestBlock <ExampleTestBlockWithReturn>(true)
            .AddFinallyBlock <ExampleFinallyBlock>()
            .ExecuteTestCase();
        }
예제 #4
0
        public void AddFinallyBlockThrowsExpectedException()
        {
            TestBuilder builder = new TestBuilder();

            builder
            .AddTestBlock <ExampleTestBlockWithReturn>(false)
            .AddFinallyBlock <ExampleFinallyBlock>()
            .ExecuteTestCase();
        }
예제 #5
0
        public void PropertyWithNoMatchingTypeInDiThrowsInvalidOperation()
        {
            TestBuilder builder = new TestBuilder();

            builder.AddTestBlock <ExampleTestBlockWithProperty>();

            Exception ex = Assert.Throws <TestCaseException>(() => builder.ExecuteTestCase());

            Assert.Equal(typeof(InvalidOperationException), ex.InnerException.GetType());
        }
예제 #6
0
        public void TestBlockThatFailsThrowsCorrectException()
        {
            TestBuilder builder = new TestBuilder();

            builder
            .AddTestBlock <ExampleTestBlockWithExecuteArg>("Bad Value");

            try
            {
                builder.ExecuteTestCase();
            }
            catch (TestCaseException ex)
            {
                Assert.Equal(typeof(EqualException), ex.InnerException.GetType());
            }
        }