public void wrap_negative() { var policy = new DecoratorPolicy <ISomething, WrappedThing>(); var instance = new ObjectInstance(GetType(), this); policy.TryWrap(instance, out var wrapped).ShouldBeFalse(); wrapped.ShouldBeNull(); }
public void wrap_positive() { var policy = new DecoratorPolicy <ISomething, WrappedThing>(); var instance = new ConstructorInstance(typeof(ISomething), typeof(InnerThing), ServiceLifetime.Transient); policy.TryWrap(instance, out var wrapped).ShouldBeTrue(); var configured = wrapped.ShouldBeOfType <ConstructorInstance>(); configured.ServiceType.ShouldBe(typeof(ISomething)); configured.ImplementationType.ShouldBe(typeof(WrappedThing)); configured.InlineDependencies.Single().ShouldBeSameAs(instance); }