public void ShouldPassUponSuccessfulExecution() { var listener = new StubListener(); new SelfTestConvention().Execute(listener , typeof(PassTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.CaseTests+PassTestClass.Pass passed."); }
public void ShouldFailWhenTestClassConstructorCannotBeInvoked() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(CannotInvokeConstructorTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.CaseTests+CannotInvokeConstructorTestClass.UnreachableCase failed: No parameterless constructor defined for this object."); }
public void ShouldPassUponSuccessfulAsyncExecution() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(AwaitThenPassTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.AsyncCaseTests+AwaitThenPassTestClass.Test passed."); }
public void ShouldFailWithOriginalExceptionWhenAsyncCaseMethodThrowsWithinTheAwaitedTask() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(AwaitOnTaskThatThrowsTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.AsyncCaseTests+AwaitOnTaskThatThrowsTestClass.Test failed: Attempted to divide by zero."); }
public void ShouldFailWithOriginalExceptionWhenCaseMethodThrows() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(FailTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.CaseTests+FailTestClass.Fail failed: 'Fail' failed!"); }
public void ShouldFailWithOriginalExceptionWhenAsyncCaseMethodThrowsBeforeAwaitingOnAnyTask() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(FailBeforeAwaitTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.AsyncCaseTests+FailBeforeAwaitTestClass.Test failed: 'Test' failed!"); }
public void ShouldFailWithOriginalExceptionWhenAsyncCaseMethodThrowsBeforeAwaitingOnAnyTask() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(FailBeforeAwaitTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.AsyncCaseTests+FailBeforeAwaitTestClass.Test failed: 'Test' failed!"); }
public void ShouldFailWithOriginalExceptionWhenAsyncCaseMethodThrowsWithinTheAwaitedTask() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(AwaitOnTaskThatThrowsTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.AsyncCaseTests+AwaitOnTaskThatThrowsTestClass.Test failed: Attempted to divide by zero."); }
public void ShouldFailWhenTestClassConstructorCannotBeInvoked() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(CannotInvokeConstructorTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.CaseTests+CannotInvokeConstructorTestClass.UnreachableCase failed: No parameterless constructor defined for this object."); }
public void ShouldFailWithOriginalExceptionWhenCaseMethodThrows() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(FailTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.CaseTests+FailTestClass.Fail failed: 'Fail' failed!"); }
public void ShouldFailWithOriginalExceptionWhenAsyncCaseMethodThrowsAfterAwaiting() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(AwaitThenFailTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.AsyncCaseTests+AwaitThenFailTestClass.Test failed: Assert.Equal() Failure" + Environment.NewLine + "Expected: 0" + Environment.NewLine + "Actual: 3"); }
public void ShouldFailUnsupportedAsyncVoidCases() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(UnsupportedAsyncVoidTestTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.AsyncCaseTests+UnsupportedAsyncVoidTestTestClass.Test failed: " + "Async void methods are not supported. Declare async methods with a return type of " + "Task to ensure the task actually runs to completion."); }
public void ShouldFailUnsupportedAsyncVoidCases() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(UnsupportedAsyncVoidTestTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.AsyncCaseTests+UnsupportedAsyncVoidTestTestClass.Test failed: " + "Async void methods are not supported. Declare async methods with a return type of " + "Task to ensure the task actually runs to completion."); }
public void ShouldFailWithOriginalExceptionWhenAsyncCaseMethodThrowsAfterAwaiting() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(AwaitThenFailTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.AsyncCaseTests+AwaitThenFailTestClass.Test failed: Assert.Equal() Failure" + Environment.NewLine + "Expected: 0" + Environment.NewLine + "Actual: 3"); }
public void ShouldExecuteAllCasesInAllDiscoveredTestClasses() { var listener = new StubListener(); var convention = new SelfTestConvention(); convention.Execute(listener, typeof(SampleIrrelevantClass), typeof(PassTestClass), typeof(int), typeof(PassFailTestClass)); listener.ShouldHaveEntries("Fixie.Tests.Conventions.ConventionTests+PassFailTestClass.Pass passed.", "Fixie.Tests.Conventions.ConventionTests+PassFailTestClass.Fail failed: 'Fail' failed!", "Fixie.Tests.Conventions.ConventionTests+PassTestClass.PassA passed.", "Fixie.Tests.Conventions.ConventionTests+PassTestClass.PassB passed."); }
public void ShouldPassOrFailCasesIndividually() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(PassFailTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.CaseTests+PassFailTestClass.FailA failed: 'FailA' failed!", "Fixie.Tests.TestClasses.CaseTests+PassFailTestClass.PassA passed.", "Fixie.Tests.TestClasses.CaseTests+PassFailTestClass.FailB failed: 'FailB' failed!", "Fixie.Tests.TestClasses.CaseTests+PassFailTestClass.PassB passed.", "Fixie.Tests.TestClasses.CaseTests+PassFailTestClass.PassC passed."); }
public void ShouldPassOrFailCasesIndividually() { var listener = new StubListener(); new SelfTestConvention().Execute(listener, typeof(PassFailTestClass)); listener.ShouldHaveEntries( "Fixie.Tests.TestClasses.CaseTests+PassFailTestClass.FailA failed: 'FailA' failed!", "Fixie.Tests.TestClasses.CaseTests+PassFailTestClass.PassA passed.", "Fixie.Tests.TestClasses.CaseTests+PassFailTestClass.FailB failed: 'FailB' failed!", "Fixie.Tests.TestClasses.CaseTests+PassFailTestClass.PassB passed.", "Fixie.Tests.TestClasses.CaseTests+PassFailTestClass.PassC passed."); }
public void ShouldExecuteAllCasesInAllDiscoveredTestClasses() { var listener = new StubListener(); var convention = new SelfTestConvention(); convention.Execute(listener, typeof(SampleIrrelevantClass), typeof(PassTestClass), typeof(int), typeof(PassFailTestClass)); listener.ShouldHaveEntries("Fixie.Tests.Conventions.ConventionTests+PassFailTestClass.Pass passed.", "Fixie.Tests.Conventions.ConventionTests+PassFailTestClass.Fail failed: 'Fail' failed!", "Fixie.Tests.Conventions.ConventionTests+PassTestClass.PassA passed.", "Fixie.Tests.Conventions.ConventionTests+PassTestClass.PassB passed."); }