Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
510 additions
and
513 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
test/Autofac.Specification.Test/Lifetime/NestedScopeTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using Xunit; | ||
|
||
namespace Autofac.Specification.Test.Lifetime | ||
{ | ||
/// <summary> | ||
/// Tests involving the lifetime of a nested scope. Tests for registering objects in a nested scope are | ||
/// in <see cref="Autofac.Specification.Test.Registration.NestedScopeRegistrationTests"/>. Tests for specifics | ||
/// around disposal are in <see cref="Autofac.Specification.Test.Lifetime.DisposalTests"/> or in the fixture | ||
/// for the specific lifetime model being tested (singleton, provided instance, etc.). | ||
/// </summary> | ||
public class NestedScopeTests | ||
{ | ||
[Fact] | ||
public void BeginLifetimeScopeCannotBeCalledWithDuplicateTag() | ||
{ | ||
var rootScope = new ContainerBuilder().Build(); | ||
const string duplicateTagName = "ABC"; | ||
var taggedScope = rootScope.BeginLifetimeScope(duplicateTagName); | ||
var differentTaggedScope = taggedScope.BeginLifetimeScope("DEF"); | ||
|
||
var exception = Assert.Throws<InvalidOperationException>(() => differentTaggedScope.BeginLifetimeScope(duplicateTagName)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.