diff --git a/test/Autofac.Test/Features/Decorators/DecoratorTests.cs b/test/Autofac.Test/Features/Decorators/DecoratorTests.cs index 81fd4f4b2..be8b2046e 100644 --- a/test/Autofac.Test/Features/Decorators/DecoratorTests.cs +++ b/test/Autofac.Test/Features/Decorators/DecoratorTests.cs @@ -193,7 +193,10 @@ public void DecoratedRegistrationCanIncludeImplementationType() public void DecoratedRegistrationCanIncludeOtherServices() { var builder = new ContainerBuilder(); - builder.RegisterType().As().As(); + + // #963: The SingleInstance here is important - a single component may expose multiple services. + // If that component is decorated, the decorator ALSO needs to expose all of those services. + builder.RegisterType().As().As().SingleInstance(); builder.RegisterDecorator(); var container = builder.Build(); diff --git a/test/Autofac.Test/Features/Decorators/OpenGenericDecoratorTests.cs b/test/Autofac.Test/Features/Decorators/OpenGenericDecoratorTests.cs index bca06a1d1..78daf7a02 100644 --- a/test/Autofac.Test/Features/Decorators/OpenGenericDecoratorTests.cs +++ b/test/Autofac.Test/Features/Decorators/OpenGenericDecoratorTests.cs @@ -190,7 +190,10 @@ public void DecoratedRegistrationCanIncludeImplementationType() public void DecoratedRegistrationCanIncludeOtherServices() { var builder = new ContainerBuilder(); - builder.RegisterGeneric(typeof(ImplementorA<>)).As(typeof(IDecoratedService<>)).As(typeof(IService<>)); + + // #963: The SingleInstance here is important - a single component may expose multiple services. + // If that component is decorated, the decorator ALSO needs to expose all of those services. + builder.RegisterGeneric(typeof(ImplementorA<>)).As(typeof(IDecoratedService<>)).As(typeof(IService<>)).SingleInstance(); builder.RegisterGenericDecorator(typeof(DecoratorA<>), typeof(IDecoratedService<>)); var container = builder.Build();