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


C# ConfiguredEndpoint.Clone方法代码示例

本文整理汇总了C#中ConfiguredEndpoint.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# ConfiguredEndpoint.Clone方法的具体用法?C# ConfiguredEndpoint.Clone怎么用?C# ConfiguredEndpoint.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConfiguredEndpoint的用法示例。


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

示例1: ExecuteTestSequence

        /// <summary>
        /// This method executes the test cases for the configured endpoint.
        /// In case of multiple channel test cases, this endpoint value is ignored and new
        /// endpoint is used to connect to the server specified in test configuration.
        /// </summary>
        /// <param name="endpoint">This parameter stores an endpoint of the server.</param>
        public void ExecuteTestSequence(ConfiguredEndpoint endpoint)
        {
            lock (m_lock)
            {
                m_cancel = false;
            }

            if (endpoint.UpdateBeforeConnect)
            {
                // create the binding factory if it has not been created yet.
                if (m_bindingFactory == null)
                {
                    m_bindingFactory = BindingFactory.Create(m_configuration, m_messageContext);
                }

                endpoint.UpdateFromServer(m_bindingFactory);
            }

            ChannelContext selectedChannelContext = null;

            selectedChannelContext = InitializeChannel(endpoint, m_logFilePath);

            try
            {
                foreach (TestCase testCase in m_sequenceToExecute.TestCase)
                {
                    if (testCase.SkipTest || testCase.Name.StartsWith(TestCases.SerializerDirect))
                    {
                        continue;
                    }
                    
                    try
                    {
                        TestUtils.ValidateTestCase(testCase, (int)testCase.Start);
                    }
                    catch (Exception e)
                    {
                        selectedChannelContext.EventLogger.LogErrorEvent(testCase, (int)testCase.Start, e);

                        if (m_sequenceToExecute.HaltOnError)
                        {
                            throw;
                        }
                        else
                        {
                            continue;
                        }
                    }

                    TestCaseContext testCaseContext = TestUtils.GetExecutionContext(testCase);

                    try
                    {
                        ValidateTestContext(testCaseContext, testCase);
                    }
                    catch (Exception e)
                    {
                        selectedChannelContext.EventLogger.LogErrorEvent(testCase, (int)testCase.Start, e);

                        if (m_sequenceToExecute.HaltOnError)
                        {
                            throw;
                        }
                        else
                        {
                            continue;
                        }
                    }

                    if (testCase.Name != TestCases.MultipleChannels)
                    {
                        ExecuteTestCase(selectedChannelContext, testCaseContext, testCase);
                    }
                    else
                    {
                        Uri defaultUrl = new Uri(endpoint.Description.EndpointUrl);

                        // In case of multiple channel get endpoint urls from the test case file.
                        List<ChannelContext> channelContextList = new List<ChannelContext>();
                        List<ConfiguredEndpoint> configuredEndpointList = new List<ConfiguredEndpoint>();
                        for (int serverCnt = 0; serverCnt < testCaseContext.ServerDetails.Count; serverCnt++)
                        {
                            string serverURL = testCaseContext.ServerDetails[serverCnt].Url;
                            serverURL = serverURL.Replace("localhost", defaultUrl.DnsSafeHost);

                            //ConfiguredEndpointCollection endpointCollection = new ConfiguredEndpointCollection () ;
                            //ConfiguredEndpoint serverendpoint = endpointCollection.Create(serverURL);
                            ConfiguredEndpoint serverendpoint = (ConfiguredEndpoint)endpoint.Clone();

                            // slow systems may not be able to renew tokens fast enough when overloaded with channels.
                            serverendpoint.Configuration.SecurityTokenLifetime = 60000;

                            serverendpoint.Description.EndpointUrl = serverURL;
                            configuredEndpointList.Add(serverendpoint);
//.........这里部分代码省略.........
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:101,代码来源:TestClient.cs


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