Permalink
Browse files

Simplify redundant try/catch surrounding attempts to dispose of test …

…class instances.
  • Loading branch information...
1 parent 4535866 commit 70383b1361346276e5b639d5b0b32f0a94eec0c9 @plioi plioi committed Aug 6, 2013
Showing with 2 additions and 19 deletions.
  1. +1 −9 src/Fixie/Behaviors/CreateInstancePerCase.cs
  2. +1 −10 src/Fixie/Behaviors/CreateInstancePerTestClass.cs
@@ -25,15 +25,7 @@ public void Execute(Type testClass, Convention convention, Case[] cases)
var fixture = new Fixture(testClass, instance, convention.CaseExecution.Behavior, new[] { @case });
convention.InstanceExecution.Behavior.Execute(fixture);
- //TODO: Further opportunity for simplification: consider not bothering with this try/catch.
- try
- {
- Lifecycle.Dispose(instance);
- }
- catch (Exception disposalException)
- {
- exceptions.Add(disposalException);
- }
+ Lifecycle.Dispose(instance);
}
catch (PreservedException preservedException)
{
@@ -21,16 +21,7 @@ public void Execute(Type testClass, Convention convention, Case[] cases)
var fixture = new Fixture(testClass, instance, convention.CaseExecution.Behavior, cases);
convention.InstanceExecution.Behavior.Execute(fixture);
- //TODO: Further opportunity for simplification: consider not bothering with this try/catch.
- try
- {
- Lifecycle.Dispose(instance);
- }
- catch (Exception disposalException)
- {
- foreach (var @case in cases)
- @case.Exceptions.Add(disposalException);
- }
+ Lifecycle.Dispose(instance);
}
catch (PreservedException preservedException)
{

0 comments on commit 70383b1

Please sign in to comment.