netbpmcontainertest.cs

来自「工作流的基本资料(文档资料」· CS 代码 · 共 53 行

CS
53
字号
using System.Collections;
using Castle.Windsor.Configuration.Interpreters;
using NetBpm.Util.Client;
using NetBpm.Workflow.Definition.EComp;
using NUnit.Framework;

namespace NetBpm.Test.Workflow
{
	[TestFixture]
	public class NetBpmContainerTest
	{
		[Test]
		public void ContainerStressTest()
		{
			for (int i=1;i<5;i++)
			{
				//configure the container
				NetBpmContainer container = new NetBpm.NetBpmContainer(new XmlInterpreter(TestHelper.GetConfigDir()+"app_config.xml"));
				IDefinitionSessionLocal definitionComponent = null;

				definitionComponent = container["DefinitionSession"] as IDefinitionSessionLocal;
				IList definitions = definitionComponent.GetProcessDefinitions(null);

				Assert.IsNotNull(definitions);

				ServiceLocator.Instance.Release(definitionComponent);
				container.Dispose();
				container=null;
			}
		}

		[Test]
		public void ServiceLocatorStressTest()
		{
			for (int i=1;i<5;i++)
			{
				//configure the container
				NetBpmContainer container = new NetBpm.NetBpmContainer(new XmlInterpreter(TestHelper.GetConfigDir()+"app_config.xml"));
				IDefinitionSessionLocal definitionComponent = null;

				definitionComponent = ServiceLocator.Instance.GetService(typeof (IDefinitionSessionLocal)) as IDefinitionSessionLocal;
				IList definitions = definitionComponent.GetProcessDefinitions(null);

				Assert.IsNotNull(definitions);

				ServiceLocator.Instance.Release(definitionComponent);
				container.Dispose();
				container=null;
			}
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?