コード例 #1
0
        public void FeatureContainerReturnsSwitchableAndUnswitchableFeatures()
        {
            // TODO: Ensure that standard IOC tests (elsewhere) require both parent and child registrations to be returned

            var containerFeature = new ContainerFeature<StructureMapContainer>();
            var application = CreateApplication(containerFeature, _nonSwitchable, _switchableOff, _switchableOn);
            var request = Mock.Of<IRequest>();
            var features = application.Features.GetFeatureSet(request);
            var services = features.Container.GetAll<IService>();
            CollectionAssert.AreEquivalent(
                new string[] { "On", "NonSwitchable" },
                services.Select(x => x.Name)
            );
        }
コード例 #2
0
 public void AddFeature(ContainerFeature feature)
 {
     Features.Add(feature);
 }
コード例 #3
0
 public void ApplicationContainerReturnsOnlyNonSwitchableServices()
 {
     var containerFeature = new ContainerFeature<StructureMapContainer>();
     var application = CreateApplication(containerFeature, _nonSwitchable, _switchableOff, _switchableOn);
     var services = application.Container.GetAll<IService>();
     Assert.AreEqual("NonSwitchable", services.Single().Name);
 }
コード例 #4
0
 public ContainerSpecification(ContainerFeature required)
 {
     requiredFeature = required;
 }