public void MismatchedTypeAddTestBlockParamsAndExecuteArgsFails() { TestBuilder builder = new TestBuilder(); builder.AddTestBlock <ExampleTestBlockWithExecuteArg>(1234); Assert.Throws <TestCaseException>(() => builder.ExecuteTestCase()); }
public void PassExecuteArgumentsViaAddTestBlockParams() { TestBuilder builder = new TestBuilder(); builder .AddTestBlock <ExampleTestBlockWithExecuteArg>("Testing") .ExecuteTestCase(); }
public void AddFinallyBlockDoesNotThrowIfExceptionOccursInFinally() { TestBuilder builder = new TestBuilder(); builder .AddTestBlock <ExampleTestBlockWithReturn>(true) .AddFinallyBlock <ExampleFinallyBlock>() .ExecuteTestCase(); }
public void AddFinallyBlockThrowsExpectedException() { TestBuilder builder = new TestBuilder(); builder .AddTestBlock <ExampleTestBlockWithReturn>(false) .AddFinallyBlock <ExampleFinallyBlock>() .ExecuteTestCase(); }
public void PropertyWithNoMatchingTypeInDiThrowsInvalidOperation() { TestBuilder builder = new TestBuilder(); builder.AddTestBlock <ExampleTestBlockWithProperty>(); Exception ex = Assert.Throws <TestCaseException>(() => builder.ExecuteTestCase()); Assert.Equal(typeof(InvalidOperationException), ex.InnerException.GetType()); }
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()); } }