当前位置: 首页>>代码示例>>C#>>正文


C# ObjectContainer类代码示例

本文整理汇总了C#中ObjectContainer的典型用法代码示例。如果您正苦于以下问题:C# ObjectContainer类的具体用法?C# ObjectContainer怎么用?C# ObjectContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ObjectContainer类属于命名空间,在下文中一共展示了ObjectContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ObjectContainerSaveState

 public void ObjectContainerSaveState(ObjectContainer o)
 {
     using (var stream = File.Create("x.ssa"))
     {
         stream.Write(_buffer, 0, 0);
     }
 }
开发者ID:theblackcascade,项目名称:ISP,代码行数:7,代码来源:StateManager.cs

示例2: RegisterDefaults

        public virtual void RegisterDefaults(ObjectContainer container)
        {
            container.RegisterTypeAs<DefaultRuntimeConfigurationProvider, IRuntimeConfigurationProvider>();

            container.RegisterTypeAs<TestRunnerManager, ITestRunnerManager>();

            container.RegisterTypeAs<StepFormatter, IStepFormatter>();
            container.RegisterTypeAs<TestTracer, ITestTracer>();

            container.RegisterTypeAs<DefaultListener, ITraceListener>();
            container.RegisterTypeAs<TraceListenerQueue, ITraceListenerQueue>(); 

            container.RegisterTypeAs<ErrorProvider, IErrorProvider>();
            container.RegisterTypeAs<RuntimeBindingSourceProcessor, IRuntimeBindingSourceProcessor>();
            container.RegisterTypeAs<RuntimeBindingRegistryBuilder, IRuntimeBindingRegistryBuilder>();
            container.RegisterTypeAs<BindingRegistry, IBindingRegistry>();
            container.RegisterTypeAs<BindingFactory, IBindingFactory>();
            container.RegisterTypeAs<StepDefinitionRegexCalculator, IStepDefinitionRegexCalculator>();
            container.RegisterTypeAs<BindingInvoker, IBindingInvoker>();

            container.RegisterTypeAs<StepDefinitionSkeletonProvider, IStepDefinitionSkeletonProvider>();
            container.RegisterTypeAs<DefaultSkeletonTemplateProvider, ISkeletonTemplateProvider>();
            container.RegisterTypeAs<StepTextAnalyzer, IStepTextAnalyzer>();

            container.RegisterTypeAs<RuntimePluginLoader, IRuntimePluginLoader>();

            container.RegisterTypeAs<BindingAssemblyLoader, IBindingAssemblyLoader>();

            RegisterUnitTestProviders(container);
        }
开发者ID:ethanmoffat,项目名称:SpecFlow,代码行数:30,代码来源:DefaultDependencyProvider.cs

示例3: ContainerShouldThrowExceptionWhenDisposed

        public void ContainerShouldThrowExceptionWhenDisposed()
        {
            var container = new ObjectContainer();
            container.Dispose();

            container.Resolve<IObjectContainer>();
        }
开发者ID:gasparnagy,项目名称:BoDi,代码行数:7,代码来源:DisposeTests.cs

示例4: TestObjectReferenceUpdate

        public void TestObjectReferenceUpdate()
        {
            var nodeContainer = new NodeContainer();
            var instance = new TestObject { Name = "Test" };
            var container = new ObjectContainer { Instance = instance };
            var containerNode = nodeContainer.GetOrCreateNode(container);
            var memberNode = containerNode.Children.First();
            var instanceNode = memberNode.Content.Reference.AsObject.TargetNode;

            // Update to a new instance
            var newInstance = new TestObject { Name = "Test2" };
            memberNode.Content.Update(newInstance);
            Helper.TestMemberContentNode(containerNode, memberNode, container, newInstance, nameof(ObjectContainer.Instance), true);
            Helper.TestNonNullObjectReference(memberNode.Content.Reference, newInstance, false);

            var newInstanceNode = nodeContainer.GetNode(newInstance);
            Helper.TestNonNullObjectReference(memberNode.Content.Reference, newInstanceNode, newInstance);
            Assert.AreNotEqual(instanceNode.Guid, newInstanceNode.Guid);

            // Update to null
            memberNode.Content.Update(null);
            Helper.TestMemberContentNode(containerNode, memberNode, container, null, nameof(ObjectContainer.Instance), true);
            Helper.TestNullObjectReference(memberNode.Content.Reference);

            // Update back to the initial instance
            memberNode.Content.Update(instance);
            Helper.TestMemberContentNode(containerNode, memberNode, container, instance, nameof(ObjectContainer.Instance), true);
            Helper.TestNonNullObjectReference(memberNode.Content.Reference, instanceNode, instance);
        }
开发者ID:cg123,项目名称:xenko,代码行数:29,代码来源:TestReferences.cs

示例5: RegisterDefaults

        public virtual void RegisterDefaults(ObjectContainer container)
        {
            container.RegisterTypeAs<DefaultRuntimeConfigurationProvider, IRuntimeConfigurationProvider>();

            container.RegisterTypeAs<TestRunnerFactory, ITestRunnerFactory>();
            container.RegisterTypeAs<TestRunner, ITestRunner>();
            container.RegisterTypeAs<TestExecutionEngine, ITestExecutionEngine>();
            container.RegisterTypeAs<StepDefinitionMatchService, IStepDefinitionMatchService>();

            container.RegisterTypeAs<StepFormatter, IStepFormatter>();
            container.RegisterTypeAs<TestTracer, ITestTracer>();

            container.RegisterTypeAs<DefaultListener, ITraceListener>();

            container.RegisterTypeAs<ErrorProvider, IErrorProvider>();
            container.RegisterTypeAs<StepArgumentTypeConverter, IStepArgumentTypeConverter>();
            container.RegisterTypeAs<BindingRegistry, IRuntimeBindingRegistryBuilder>();
            container.RegisterTypeAs<BindingRegistry, IBindingRegistry>();
            container.RegisterTypeAs<BindingFactory, IBindingFactory>();
            container.RegisterTypeAs<StepDefinitionRegexCalculator, IStepDefinitionRegexCalculator>();
            container.RegisterTypeAs<BindingInvoker, IBindingInvoker>();

            container.RegisterTypeAs<ContextManager, IContextManager>();

            container.RegisterTypeAs<StepDefinitionSkeletonProviderCS, IStepDefinitionSkeletonProvider>(ProgrammingLanguage.CSharp.ToString());
            container.RegisterTypeAs<StepDefinitionSkeletonProviderVB, IStepDefinitionSkeletonProvider>(ProgrammingLanguage.VB.ToString());

            container.RegisterTypeAs<RuntimePluginLoader, IRuntimePluginLoader>();

            container.RegisterTypeAs<BindingAssemblyLoader, IBindingAssemblyLoader>();

            RegisterUnitTestProviders(container);
        }
开发者ID:kenlefeb,项目名称:SpecFlow,代码行数:33,代码来源:DefaultDependencyProvider.cs

示例6: CreateContainer

        public static IObjectContainer CreateContainer(SpecFlowConfigurationHolder configurationHolder, ProjectSettings projectSettings)
        {
            var container = new ObjectContainer();

            RegisterDefaults(container);

            var specFlowConfiguration = container.Resolve<ISpecFlowProjectConfigurationLoader>()
                .LoadConfiguration(configurationHolder);

            if (specFlowConfiguration.GeneratorConfiguration.CustomDependencies != null)
                container.RegisterFromConfiguration(specFlowConfiguration.GeneratorConfiguration.CustomDependencies);

            container.RegisterInstanceAs(specFlowConfiguration);
            container.RegisterInstanceAs(specFlowConfiguration.GeneratorConfiguration);
            container.RegisterInstanceAs(specFlowConfiguration.RuntimeConfiguration);

            var generatorInfo = container.Resolve<IGeneratorInfoProvider>().GetGeneratorInfo();
            container.RegisterInstanceAs(generatorInfo);

            container.RegisterInstanceAs(projectSettings);

            container.RegisterInstanceAs(container.Resolve<CodeDomHelper>(projectSettings.ProjectPlatformSettings.Language));

            if (specFlowConfiguration.GeneratorConfiguration.GeneratorUnitTestProvider != null)
                container.RegisterInstanceAs(container.Resolve<IUnitTestGeneratorProvider>(specFlowConfiguration.GeneratorConfiguration.GeneratorUnitTestProvider));

            return container;
        }
开发者ID:ChrisEdwards,项目名称:SpecFlow,代码行数:28,代码来源:GeneratorContainerBuilder.cs

示例7: ObjectInfo

 /* CONSTRUCTOR */
 public ObjectInfo (ObjectContainer container)
 {
         Container = container;
         Depends = container.Depends.ToArray ();
         SystemType = container.SystemType;
         RefId = container.RefId;
 }
开发者ID:sslab-gatech,项目名称:juxta,代码行数:8,代码来源:test.cs

示例8: Init

		public override void Init()
		{
			base.Init();

			_box = (BeerBox) Container["beer.box"];

			_objContainer = (ObjectContainer)Container[typeof(ObjectContainer)];
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:8,代码来源:TransactionalTestCase.cs

示例9: Serialize

 public void Serialize(ObjectContainer o)
 {
     var formatter = new BinaryFormatter();
     using (var stream = File.Create("x.dat"))
     {
         formatter.Serialize(stream, o);
     }
 }
开发者ID:theblackcascade,项目名称:ISP,代码行数:8,代码来源:StateManager.cs

示例10: ShouldNotRegisterInvalidTypeMapping

        public void ShouldNotRegisterInvalidTypeMapping()
        {
            // given
            var container = new ObjectContainer();

            // then
            Assert.Catch<InvalidOperationException>(() => container.RegisterTypeAs(typeof(SimpleClassExtendingGenericInterface), typeof(IGenericInterface<>)));
        }
开发者ID:gasparnagy,项目名称:BoDi,代码行数:8,代码来源:RegisterTypeTests.cs

示例11: RegisterDefaults

 private static void RegisterDefaults(ObjectContainer container)
 {
     container.RegisterTypeAs<SpecFlowProjectConfigurationLoader, ISpecFlowProjectConfigurationLoader>();
     container.RegisterTypeAs<InProcGeneratorInfoProvider, IGeneratorInfoProvider>();
     container.RegisterTypeAs<TestGenerator, ITestGenerator>();
     container.RegisterTypeAs<TestHeaderWriter, ITestHeaderWriter>();
     container.RegisterTypeAs<TestUpToDateChecker, ITestUpToDateChecker>();
 }
开发者ID:roffster,项目名称:SpecFlow,代码行数:8,代码来源:GeneratorContainerBuilder.cs

示例12: CreateTestRunnerContainer

        public IObjectContainer CreateTestRunnerContainer(IObjectContainer globalContainer)
        {
            var testRunnerContainer = new ObjectContainer(globalContainer);

            defaultDependencyProvider.RegisterTestRunnerDefaults(testRunnerContainer);

            return testRunnerContainer;
        }
开发者ID:ethanmoffat,项目名称:SpecFlow,代码行数:8,代码来源:TestRunContainerBuilder.cs

示例13: SetUp

 public void SetUp()
 {
     mockTestRunner = MockRepository.GenerateMock<ITestRunner>();
     var container = new ObjectContainer();
     container.RegisterInstanceAs(mockTestRunner);
     steps = new StepsTestableHelper();
     ((IContainerDependentObject)steps).SetObjectContainer(container);
 }
开发者ID:ethanmoffat,项目名称:SpecFlow,代码行数:8,代码来源:StepsTest.cs

示例14: DisplayValue

        private static string DisplayValue(Tk5FieldInfoEx field, ObjectContainer container, bool showHint)
        {
            TkDebug.AssertArgumentNull(field, "field", null);

            //if (field.Upload != null)
            //    return DisplayUpload(field, row);

            object receiver = container.MainObject;
            string displayValue = string.Empty;
            string value = string.Empty;
            try
            {
                value = receiver.MemberValue(field.NickName).ConvertToString();
                if (field.Decoder == null || field.Decoder.Type == DecoderType.None)
                    displayValue = FormatNumber(field, field.NickName, receiver);
                else
                    displayValue = container.Decoder.GetNameString(field.NickName);
            }
            catch
            {
                displayValue = value;
            }
            if (showHint)
            {
                if (!string.IsNullOrEmpty(field.Hint))
                    displayValue += " " + field.Hint;
            }
            if (field.ListDetail != null && field.ListDetail.Link != null)
            {
                var link = field.ListDetail.Link;
                string linkUrl = string.Empty;
                string target = string.Empty;
                switch (link.RefType)
                {
                    case LinkRefType.Href:
                        linkUrl = HtmlUtil.ParseLinkUrl(receiver, link.Content);
                        linkUrl = WebUtil.ResolveUrl(linkUrl);
                        if (!string.IsNullOrEmpty(link.Base))
                            linkUrl = UriUtil.CombineUri(link.Base, linkUrl).ToString();
                        if (!string.IsNullOrEmpty(link.Target))
                            target = string.Format(ObjectUtil.SysCulture, " target=\"{0}\"", link.Target);
                        break;
                    case LinkRefType.Http:
                        if (!value.StartsWith("http", StringComparison.OrdinalIgnoreCase))
                            linkUrl = "http://";
                        linkUrl += value;
                        target = " target=\"_blank\"";
                        break;
                    case LinkRefType.Email:
                        linkUrl = "mailto:" + value;
                        target = " target=\"_blank\"";
                        break;
                }
                return string.Format(ObjectUtil.SysCulture, "<a href=\"{0}\"{1}>{2}</a>",
                    StringUtil.EscapeHtmlAttribute(linkUrl), target, StringUtil.EscapeHtml(displayValue));
            }
            return displayValue;
        }
开发者ID:ZLLselfRedeem,项目名称:zllinmitu,代码行数:58,代码来源:HtmlExtension_Object.cs

示例15: LoadPlugins

        private static IGeneratorPlugin[] LoadPlugins(ObjectContainer container, IGeneratorConfigurationProvider configurationProvider, SpecFlowConfigurationHolder configurationHolder)
        {
            var plugins = container.Resolve<IDictionary<string, IGeneratorPlugin>>().Values.AsEnumerable();

            var pluginLoader = container.Resolve<IGeneratorPluginLoader>();
            plugins = plugins.Concat(configurationProvider.GetPlugins(configurationHolder).Where(pd => (pd.Type & PluginType.Generator) != 0).Select(pd => LoadPlugin(pluginLoader, pd)));

            return plugins.ToArray();
        }
开发者ID:Galad,项目名称:SpecFlow,代码行数:9,代码来源:GeneratorContainerBuilder.cs


注:本文中的ObjectContainer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。