Skip to content

Commit

Permalink
update test case for issue autofac#963
Browse files Browse the repository at this point in the history
  • Loading branch information
RaymondHuy committed Jan 26, 2020
1 parent 554b91a commit 451a20a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
15 changes: 10 additions & 5 deletions test/Autofac.Test/Features/Decorators/DecoratorTests.cs
Expand Up @@ -104,7 +104,7 @@ public void DecoratedInstancePerDependencyRegistrationCanIncludeOtherServices()
Assert.NotSame(serviceInstance, decoratedServiceInstance);
}

[Fact(Skip = "Issue #963")]
[Fact]
public void DecoratedInstancePerLifetimeScopeRegistrationCanIncludeOtherServices()
{
var builder = new ContainerBuilder();
Expand All @@ -128,10 +128,10 @@ public void DecoratedInstancePerLifetimeScopeRegistrationCanIncludeOtherServices
var decoratedServiceInstance = container.Resolve<IDecoratedService>();
Assert.IsType<DecoratorA>(decoratedServiceInstance);

Assert.Same(serviceInstance, decoratedServiceInstance);
Assert.Same(serviceInstance, decoratedServiceInstance.Decorated);
}

[Fact(Skip = "Issue #963")]
[Fact]
public void DecoratedSingleInstanceRegistrationCanIncludeOtherServices()
{
var builder = new ContainerBuilder();
Expand All @@ -149,8 +149,13 @@ public void DecoratedSingleInstanceRegistrationCanIncludeOtherServices()
Assert.NotNull(decoratedServiceRegistration);
Assert.Same(serviceRegistration, decoratedServiceRegistration);

Assert.IsType<ImplementorA>(container.Resolve<IService>());
Assert.IsType<DecoratorA>(container.Resolve<IDecoratedService>());
var serviceInstance = container.Resolve<IService>();
Assert.IsType<ImplementorA>(serviceInstance);

var decoratedServiceInstance = container.Resolve<IDecoratedService>();
Assert.IsType<DecoratorA>(decoratedServiceInstance);

Assert.Same(serviceInstance, decoratedServiceInstance.Decorated);
}

[Fact]
Expand Down
Expand Up @@ -222,7 +222,7 @@ public void DecoratedInstancePerDependencyRegistrationCanIncludeOtherServices()
Assert.NotSame(serviceInstance, decoratedServiceInstance);
}

[Fact(Skip = "Issue #963")]
[Fact]
public void DecoratedInstancePerLifetimeScopeRegistrationCanIncludeOtherServices()
{
var builder = new ContainerBuilder();
Expand All @@ -241,15 +241,15 @@ public void DecoratedInstancePerLifetimeScopeRegistrationCanIncludeOtherServices
Assert.Same(serviceRegistration, decoratedServiceRegistration);

var serviceInstance = container.Resolve<IService<int>>();
Assert.IsType<DecoratorA<int>>(serviceInstance);
Assert.IsType<ImplementorA<int>>(serviceInstance);

var decoratedServiceInstance = container.Resolve<IDecoratedService<int>>();
Assert.IsType<DecoratorA<int>>(decoratedServiceInstance);

Assert.Same(serviceInstance, decoratedServiceInstance);
Assert.Same(serviceInstance, decoratedServiceInstance.Decorated);
}

[Fact(Skip = "Issue #963")]
[Fact]
public void DecoratedSingleInstanceRegistrationCanIncludeOtherServices()
{
var builder = new ContainerBuilder();
Expand All @@ -268,12 +268,12 @@ public void DecoratedSingleInstanceRegistrationCanIncludeOtherServices()
Assert.Same(serviceRegistration, decoratedServiceRegistration);

var serviceInstance = container.Resolve<IService<int>>();
Assert.IsType<DecoratorA<int>>(serviceInstance);
Assert.IsType<ImplementorA<int>>(serviceInstance);

var decoratedServiceInstance = container.Resolve<IDecoratedService<int>>();
Assert.IsType<DecoratorA<int>>(decoratedServiceInstance);

Assert.Same(serviceInstance, decoratedServiceInstance);
Assert.Same(serviceInstance, decoratedServiceInstance.Decorated);
}

[Fact]
Expand Down

0 comments on commit 451a20a

Please sign in to comment.