Skip to content

Commit

Permalink
Added skipped/failing test for #963.
Browse files Browse the repository at this point in the history
  • Loading branch information
tillig committed Mar 19, 2019
1 parent 7d37488 commit f5746dc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/Autofac.Specification.Test/Features/DecoratorTests.cs
Expand Up @@ -259,6 +259,24 @@ public void DecoratorAndDecoratedBothDisposedWhenSingleInstance()
Assert.Equal(1, decorated.DisposeCallCount);
}

[Fact(Skip = "Issue #963: Need to figure out how to track which decorators have already been applied.")]
public void DecoratorAppliedOnlyOnceToComponent()
{
// #965: A nested lifetime scope that has a registration lambda
// causes the decorator to be applied twice - once for the container
// level, once for the scope level. This doesn't seem to happen
// if there's no registration lambda.
var builder = new ContainerBuilder();
builder.RegisterType<ImplementorA>().As<IDecoratedService>();
builder.RegisterDecorator<DecoratorA, IDecoratedService>();
var container = builder.Build();

var scope = container.BeginLifetimeScope(b => { });
var service = scope.Resolve<IDecoratedService>();
Assert.IsType<DecoratorA>(service);
Assert.IsType<ImplementorA>(service.Decorated);
}

[Fact]
public void DecoratorCanBeAppliedToServiceRegisteredInChildLifetimeScope()
{
Expand Down

0 comments on commit f5746dc

Please sign in to comment.