Small optimizations
This commit is contained in:
Родитель
b190b5ba70
Коммит
1955484af6
|
@ -163,14 +163,5 @@ namespace Microsoft.Practices.Unity.TestSupport
|
|||
|
||||
return Strategies.ExecuteBuildUp(this);
|
||||
}
|
||||
|
||||
public object ExecuteTearDown(object existing)
|
||||
{
|
||||
this.BuildKey = null;
|
||||
this.Existing = existing;
|
||||
|
||||
Strategies.Reverse().ExecuteTearDown(this);
|
||||
return existing;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,40 +102,6 @@ namespace Microsoft.Practices.Unity.TestSupport
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute this strategy chain against the given context,
|
||||
/// calling the TearDown methods on the strategies.
|
||||
/// </summary>
|
||||
/// <param name="context">Context for the teardown process.</param>
|
||||
public void ExecuteTearDown(IBuilderContext builderContext)
|
||||
{
|
||||
var context = builderContext ?? throw new ArgumentNullException(nameof(builderContext));
|
||||
int i = 0;
|
||||
|
||||
try
|
||||
{
|
||||
for (; i < _strategies.Count; ++i)
|
||||
{
|
||||
if (context.BuildComplete)
|
||||
{
|
||||
--i; // Skip current strategy's post
|
||||
break;
|
||||
}
|
||||
_strategies[i].PreTearDown(context);
|
||||
}
|
||||
|
||||
for (--i; i >= 0; --i)
|
||||
{
|
||||
_strategies[i].PostTearDown(context);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
context.RecoveryStack.ExecuteRecovery();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#region IEnumerable<IBuilderStrategy> Members
|
||||
|
||||
/// <summary>
|
||||
|
|
Загрузка…
Ссылка в новой задаче