當前位置: 首頁>>代碼示例>>C#>>正文


C# Agent.Init方法代碼示例

本文整理匯總了C#中Agent.Init方法的典型用法代碼示例。如果您正苦於以下問題:C# Agent.Init方法的具體用法?C# Agent.Init怎麽用?C# Agent.Init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Agent的用法示例。


在下文中一共展示了Agent.Init方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: TestAccess

        public void TestAccess()
        {
            var agent = new Agent().Face<ITestAgent>();
            agent["Access"] = new Bin<bool>();

            agent.Init("stream", typeof(Stream), false);
            try
            {
                var f = agent["stream"].First;
            }
            catch (Exception e)
            {
                Assert.Inconclusive(e.ToString());
            }

            Assert.AreEqual(false, agent["Access"].First);

            Assert.AreEqual(1, agent["Access"].Count);

            agent.Init("Secure", true);
            agent["Secure"].Add(true);

            Assert.AreEqual(true, agent["Secure"][1]);
            Assert.AreEqual(2, agent["Secure"].Count);
        }
開發者ID:velcrome,項目名稱:vvvv-Game,代碼行數:25,代碼來源:FaceAgentTest.cs

示例2: TestInt

        public void TestInt()
        {
            var agent = new Agent();

            agent.Init("Test", 1);
            Assert.AreEqual(1, agent["Test"][0], "Vanilla Agent int initialisation");

            agent["Test"].Add(2);
            Assert.AreEqual(2, agent["Test"][1], "Vanilla Agent int append");

            var l = new List<int> { 3, 4 };
            agent["Test"].Add(l);

            Assert.AreEqual(3, agent["Test"][2], "Vanilla Agent int add IEnumeration");
            Assert.AreEqual(4, agent["Test"][3], "Vanilla Agent int add IEnumeration");

            agent["Test"].First =0;
            Assert.AreEqual(0, agent["Test"][0], "Vanilla Agent int set First");
            Assert.AreEqual(0, agent["Test"].First, "Vanilla Agent int get First");

            agent["Test"].AssignFrom(l);
            Assert.AreEqual(3, agent["Test"][0], "Vanilla Agent int assign IEnumeration");
            Assert.AreEqual(4, agent["Test"][1], "Vanilla Agent int assign IEnumeration");

            Assert.AreEqual(2, agent["Test"].Count, "Vanilla Agent int Count");

            agent.Init<int>("SecondTestInt");
            agent["SecondTestInt"].Add(1);
            Assert.AreEqual(1, agent["SecondTestInt"].First);
        }
開發者ID:velcrome,項目名稱:vvvv-Game,代碼行數:30,代碼來源:AgentTest.cs

示例3: TestDouble

        public void TestDouble()
        {
            var agent = new Agent();

            agent.Init("Test", 1.0);
            Assert.AreEqual(1.0, agent["Test"][0], "Vanilla Agent double initialisation");

            agent["Test"].Add(2.0);
            Assert.AreEqual(2.0, agent["Test"][1], "Vanilla Agent double append");

            var l = new List<double> { 3.0, 4.0 };
            agent["Test"].Add(l);

            Assert.AreEqual(3.0, agent["Test"][2], "Vanilla Agent double add IEnumeration");
            Assert.AreEqual(4.0, agent["Test"][3], "Vanilla Agent double add IEnumeration");

            agent["Test"].First = 0.0;
            Assert.AreEqual(0.0, agent["Test"][0], "Vanilla Agent double set First");
            Assert.AreEqual(0.0, agent["Test"].First, "Vanilla Agent double get First");

            agent["Test"].AssignFrom(l);
            Assert.AreEqual(3.0, agent["Test"][0], "Vanilla Agent double assign IEnumeration");
            Assert.AreEqual(4.0, agent["Test"][1], "Vanilla Agent double assign IEnumeration");

            Assert.AreEqual(2, agent["Test"].Count, "Vanilla Agent double Count");
        }
開發者ID:velcrome,項目名稱:vvvv-Game,代碼行數:26,代碼來源:AgentTest.cs

示例4: TestInt

        public void TestInt()
        {
            dynamic agent = new Agent();

            agent.TestInt = new Bin<int>(1);
            Assert.AreEqual(1, agent.TestInt[0], "Dynamic Agent int initialisation");

            agent.TestInt.Add(2);
            Assert.AreEqual(2, agent.TestInt[1], "Dynamic Agent int append");

            var l = new List<int> { 3, 4 };
            agent.TestInt.Add(l);

            Assert.AreEqual(3, agent.TestInt[2], "Dynamic Agent int add IEnumeration");
            Assert.AreEqual(4, agent.TestInt[3], "Dynamic Agent int add IEnumeration");

            agent.TestInt.First = 0;
            Assert.AreEqual(0, agent.TestInt[0], "Dynamic Agent int set First");
            Assert.AreEqual(0, agent.TestInt.First, "Dynamic Agent int get First");

            agent.TestInt.AssignFrom(l);
            Assert.AreEqual(3, agent.TestInt[0], "Dynamic Agent int assign IEnumeration");
            Assert.AreEqual(4, agent.TestInt[1], "Dynamic Agent int assign IEnumeration");

            Assert.AreEqual(2, agent.TestInt.Count, "Dynamic Agent int Count");

            agent.Init<int>("SecondTestInt");
            agent.SecondTestInt.Add(1);
            Assert.AreEqual(1, agent.SecondTestInt.First);
        }
開發者ID:velcrome,項目名稱:vvvv-Game,代碼行數:30,代碼來源:DynamicAgentTest.cs

示例5: Init

 public void Init(Boolean autostart)
 {
     Agent agent = new Agent();
     agent.Init();
     this.thread = new Thread(new ThreadStart(agent.Run));
     if (autostart == true)
     {
         this.thread.Start();
     }
 }
開發者ID:heliocentric,項目名稱:dagent,代碼行數:10,代碼來源:AgentControl.cs

示例6: TestClone

        public void TestClone()
        {
            var agent = new Agent();
            agent["Access"] = new Bin<bool>(true, false);

            agent.Init("Test", new Vector3D());
            agent["Test"].Add(new Vector3D(1.0,1.0,1.0));

            var copy = (Agent)agent.Clone();

            Assert.AreEqual(true, copy["Access"].First);
            Assert.AreEqual(false, copy["Access"][1]);

            Assert.AreEqual(0.0, ((Vector3D)copy["Test"].First).x);
            Assert.AreEqual(1.0, ((Vector3D)copy["Test"][1]).x);
        }
開發者ID:velcrome,項目名稱:vvvv-Game,代碼行數:16,代碼來源:AgentTest.cs

示例7: TestString

        public void TestString()
        {
            var agent = new Agent();

            agent.Init("Test", "First");
            Assert.AreEqual("First", agent["Test"][0], "Vanilla Agent string initialisation");

            agent["Test"].Add("Second");
            Assert.AreEqual("Second", agent["Test"][1], "Vanilla Agent string append");

            var l = new List<string> {"Third", "Fourth"};
            agent["Test"].Add(l);

            Assert.AreEqual("Third", agent["Test"][2], "Vanilla Agent string add IEnumeration");
            Assert.AreEqual("Fourth", agent["Test"][3], "Vanilla Agent string add IEnumeration");

            agent["Test"].First = "Zero";
            Assert.AreEqual("Zero", agent["Test"][0], "Vanilla Agent string set First");
            Assert.AreEqual("Zero", agent["Test"].First, "Vanilla Agent string get First");

            agent["Test"].AssignFrom(l);
            Assert.AreEqual("Third", agent["Test"][0], "Vanilla Agent string assign IEnumeration");
            Assert.AreEqual("Fourth", agent["Test"][1], "Vanilla Agent string assign IEnumeration");

            Assert.AreEqual(2, agent["Test"].Count, "Vanilla Agent int Count");
        }
開發者ID:velcrome,項目名稱:vvvv-Game,代碼行數:26,代碼來源:AgentTest.cs

示例8: TestVector3D

        public void TestVector3D()
        {
            var v0 = new Vector3D(0, 0, 0);
            var v1 = new Vector3D(1, 1, 1);
            var v2 = new Vector3D(2, 2, 2);
            var v3 = new Vector3D(3, 3, 3);
            var v4 = new Vector3D(4, 4, 4);

            var agent = new Agent();

            agent.Init("Test", v1);
            Assert.AreEqual(v1, agent["Test"][0], "Vanilla Agent Vector3D initialisation");

            agent["Test"].Add(v2);
            Assert.AreEqual(v2, agent["Test"][1], "Vanilla Agent Vector3D append");

            var l = new List<Vector3D> { v3, v4 };
            agent["Test"].Add(l);

            Assert.AreEqual(v3, agent["Test"][2], "Vanilla Agent Vector3D add IEnumeration");
            Assert.AreEqual(v4, agent["Test"][3], "Vanilla Agent Vector3D add IEnumeration");

            agent["Test"].First = v0;
            Assert.AreEqual(v0, agent["Test"][0], "Vanilla Agent Vector3D set First");
            Assert.AreEqual(v0, agent["Test"].First, "Vanilla Agent Vector3D get First");

            agent["Test"].AssignFrom(l);
            Assert.AreEqual(v3, agent["Test"][0], "Vanilla Agent Vector3D assign IEnumeration");
            Assert.AreEqual(v4, agent["Test"][1], "Vanilla Agent Vector3D assign IEnumeration");

            Assert.AreEqual(2, agent["Test"].Count, "Vanilla Agent Vector3D Count");
        }
開發者ID:velcrome,項目名稱:vvvv-Game,代碼行數:32,代碼來源:AgentTest.cs


注:本文中的Agent.Init方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。