public void TestMethodAssertThrowsLambda() { Assert.IsTrue(StfAssert.AssertThrows <ApplicationException>( "true", () => MethodWithParamCanThrow <ApplicationException>(true))); Assert.IsFalse(StfAssert.AssertThrows <ApplicationException>( "false", () => MethodWithParamCanThrow <ApplicationException>(false))); }
public void TestMethodProxyObjectCreatedForPluginWithMatchingInterface() { // need to load the UnitTest plug-ins LoadAdditionalStfPlugins(".", "Stf.UnitTestPlugin*.dll"); var sp2 = Get <IStfUnitTestPlugin2>(); StfAssert.IsNotNull( "Has interface", typeof(StfUnitTestPlugin2).GetInterface(typeof(IStfUnitTestPlugin2).Name)); StfAssert.AssertThrows <InvalidCastException>( "Unit test plugin is a proxy object", // ReSharper disable once UnusedVariable () => { var stfUnitTestPlugin2 = (StfUnitTestPlugin2)sp2; }); }
public void TestMethodUnknownTypeThrowsException() { StfAssert.AssertThrows <StfTypeResolutionException>("Resolve unknown for STF type", () => Get <StfTypeResolutionException>()); StfAssert.AssertThrows <StfTypeResolutionException>("Resolve unknown for STF type", () => Get <int>()); }
public void TestMethodAssertThrows() { Assert.IsTrue(StfAssert.AssertThrows <NotImplementedException>("true", ThrowNotImplementedException)); Assert.IsFalse(StfAssert.AssertThrows <ArgumentException>("false", ThrowNotImplementedException)); }