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


C# Test.List.Remove方法代码示例

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


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

示例1: allTests

    public static void allTests(Ice.Communicator communicator)
    {
        string @ref = "communicator:default -p 12010";
        RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(@ref));

        System.Random rand = new System.Random(unchecked((int)System.DateTime.Now.Ticks));

        Console.Out.Write("testing binding with single endpoint... ");
        Console.Out.Flush();
        {
            RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter", "default");

            TestIntfPrx test1 = adapter.getTestIntf();
            TestIntfPrx test2 = adapter.getTestIntf();
            test(test1.ice_getConnection() == test2.ice_getConnection());

            test1.ice_ping();
            test2.ice_ping();

            com.deactivateObjectAdapter(adapter);

            TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1);
            test(test3.ice_getConnection() == test1.ice_getConnection());
            test(test3.ice_getConnection() == test2.ice_getConnection());

            try
            {
                test3.ice_ping();
                test(false);
            }
            catch(Ice.ConnectionRefusedException)
            {
            }
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("testing binding with multiple endpoints... ");
        Console.Out.Flush();
        {
            ArrayList adapters = new ArrayList();
            adapters.Add(com.createObjectAdapter("Adapter11", "default"));
            adapters.Add(com.createObjectAdapter("Adapter12", "default"));
            adapters.Add(com.createObjectAdapter("Adapter13", "default"));

            //
            // Ensure that when a connection is opened it's reused for new
            // proxies and that all endpoints are eventually tried.
            //
            List<string> names = new List<string>();
            names.Add("Adapter11");
            names.Add("Adapter12");
            names.Add("Adapter13");
            while(names.Count > 0)
            {
                ArrayList adpts = new ArrayList(adapters);

                TestIntfPrx test1 = createTestIntfPrx(adpts);
                shuffle(ref adpts);
                TestIntfPrx test2 = createTestIntfPrx(adpts);
                shuffle(ref adpts);
                TestIntfPrx test3 = createTestIntfPrx(adpts);
                test1.ice_ping();
                test(test1.ice_getConnection() == test2.ice_getConnection());
                test(test2.ice_getConnection() == test3.ice_getConnection());

                names.Remove(test1.getAdapterName());
                test1.ice_getConnection().close(false);
            }

            //
            // Ensure that the proxy correctly caches the connection (we
            // always send the request over the same connection.)
            //
            {
                foreach(RemoteObjectAdapterPrx adpt in adapters)
                {
                    adpt.getTestIntf().ice_ping();
                }

                TestIntfPrx t = createTestIntfPrx(adapters);
                string name = t.getAdapterName();
                int nRetry = 10;
                int i;
                for(i = 0; i < nRetry && t.getAdapterName().Equals(name); i++);
                test(i == nRetry);

                foreach(RemoteObjectAdapterPrx adpt in adapters)
                {
                    adpt.getTestIntf().ice_getConnection().close(false);
                }
            }

            //
            // Deactivate an adapter and ensure that we can still
            // establish the connection to the remaining adapters.
            //
            com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[0]);
            names.Add("Adapter12");
            names.Add("Adapter13");
            while(names.Count > 0)
//.........这里部分代码省略.........
开发者ID:bholl,项目名称:zeroc-ice,代码行数:101,代码来源:AllTests.cs

示例2: allTests


//.........这里部分代码省略.........
            communicator.stringToProxy("object @ oa1").ice_ping();
            communicator.stringToProxy("object").ice_ping();
            proxies[0].removeObject("oa", "object");

            proxies[1].addObject("oa", "object");
            communicator.stringToProxy("object @ oa2").ice_ping();
            communicator.stringToProxy("object").ice_ping();
            proxies[1].removeObject("oa", "object");

            try
            {
                communicator.stringToProxy("object @ oa1").ice_ping();
            }
            catch(Ice.ObjectNotExistException)
            {
            }
            try
            {
                communicator.stringToProxy("object @ oa2").ice_ping();
            }
            catch(Ice.ObjectNotExistException)
            {
            }

            proxies[0].deactivateObjectAdapter("oa");
            proxies[1].deactivateObjectAdapter("oa");
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("testing replica groups...");
        Console.Out.Flush();
        {
            proxies[0].activateObjectAdapter("oa", "oa1", "rg");
            proxies[1].activateObjectAdapter("oa", "oa2", "rg");
            proxies[2].activateObjectAdapter("oa", "oa3", "rg");

            proxies[0].addObject("oa", "object");
            proxies[1].addObject("oa", "object");
            proxies[2].addObject("oa", "object");

            communicator.stringToProxy("object @ oa1").ice_ping();
            communicator.stringToProxy("object @ oa2").ice_ping();
            communicator.stringToProxy("object @ oa3").ice_ping();

            communicator.stringToProxy("object @ rg").ice_ping();

            List<string> adapterIds = new List<string>();
            adapterIds.Add("oa1");
            adapterIds.Add("oa2");
            adapterIds.Add("oa3");
            TestIntfPrx intf = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("object"));
            intf = (TestIntfPrx)intf.ice_connectionCached(false).ice_locatorCacheTimeout(0);
            while(adapterIds.Count > 0)
            {
                adapterIds.Remove(intf.getAdapterId());
            }

            while(true)
            {
                adapterIds.Add("oa1");
                adapterIds.Add("oa2");
                adapterIds.Add("oa3");
                intf = TestIntfPrxHelper.uncheckedCast(
                    communicator.stringToProxy("object @ rg").ice_connectionCached(false));
                int nRetry = 100;
                while(adapterIds.Count > 0 && --nRetry > 0)
                {
                    adapterIds.Remove(intf.getAdapterId());
                }
                if(nRetry > 0)
                {
                    break;
                }

                // The previous locator lookup probably didn't return all the replicas... try again.
                communicator.stringToProxy("object @ rg").ice_locatorCacheTimeout(0).ice_ping();
            }

            proxies[0].deactivateObjectAdapter("oa");
            proxies[1].deactivateObjectAdapter("oa");
            test(TestIntfPrxHelper.uncheckedCast(
                     communicator.stringToProxy("object @ rg")).getAdapterId().Equals("oa3"));
            proxies[2].deactivateObjectAdapter("oa");

            proxies[0].activateObjectAdapter("oa", "oa1", "rg");
            proxies[0].addObject("oa", "object");
            test(TestIntfPrxHelper.uncheckedCast(
                     communicator.stringToProxy("object @ rg")).getAdapterId().Equals("oa1"));
            proxies[0].deactivateObjectAdapter("oa");
        }
        Console.Out.WriteLine("ok");

        Console.Out.Write("shutting down... ");
        Console.Out.Flush();
        foreach(ControllerPrx prx in proxies)
        {
            prx.shutdown();
        }
        Console.Out.WriteLine("ok");
    }
开发者ID:externl,项目名称:ice,代码行数:101,代码来源:AllTests.cs


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