当前位置: 首页>>代码示例>>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;未经允许,请勿转载。