Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…class instances.
  • Loading branch information...
commit 70383b1361346276e5b639d5b0b32f0a94eec0c9 1 parent 4535866
Patrick Lioi plioi authored
10 src/Fixie/Behaviors/CreateInstancePerCase.cs
View
@@ -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)
{
11 src/Fixie/Behaviors/CreateInstancePerTestClass.cs
View
@@ -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)
{
Please sign in to comment.
Something went wrong with that request. Please try again.