public void ActivationCreatesNamedScopeReferenceUsingTheKernel() { var requestParameters = new List<IParameter>(); var reference = new InstanceReference { Instance = new object() }; var namedScopeParameter = new NamedScopeParameter("Scope1"); var kernelMock = new Mock<IKernel>(); var contextMock = CreateContextMock(); contextMock.Object.Parameters.Add(namedScopeParameter); contextMock.SetupGet(context => context.Kernel).Returns(kernelMock.Object); SetupKernelGetNamedScopeReference(kernelMock, requestParameters); var testee = new NamedScopeActivationStrategy(); testee.Activate(contextMock.Object, reference); requestParameters.Count().Should().Be(2); AssertConstructorArgumentExists("scope", namedScopeParameter.Scope, requestParameters); AssertNamedScopeReferenceScopeParameterExists(reference.Instance, requestParameters); }
public void ActivationCreatesNamedScopeReferenceUsingTheKernel() { var requestParameters = new List <IParameter>(); var reference = new InstanceReference { Instance = new object() }; var namedScopeParameter = new NamedScopeParameter("Scope1"); var kernelMock = new Mock <IKernel>(); var contextMock = CreateContextMock(); contextMock.Object.Parameters.Add(namedScopeParameter); contextMock.SetupGet(context => context.Kernel).Returns(kernelMock.Object); SetupKernelGetNamedScopeReference(kernelMock, requestParameters); var testee = new NamedScopeActivationStrategy(); testee.Activate(contextMock.Object, reference); requestParameters.Count().Should().Be(2); AssertConstructorArgumentExists("scope", namedScopeParameter.Scope, requestParameters); AssertNamedScopeReferenceScopeParameterExists(reference.Instance, requestParameters); }