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


C# Table.AllMethods方法代码示例

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


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

示例1: AllMethods__Dont_Include___prepareclass_From_Parent_Tables

        public void AllMethods__Dont_Include___prepareclass_From_Parent_Tables()
        {
            Table cls = new Table("Class");
            Table mixin = new Table("Mixin");
            cls.Mixins.Add(mixin);

            IMethod __prepareclass = MockRepository.GenerateStub<IMethod>();
            __prepareclass.Expect(x => x.Table).Return(mixin);
            __prepareclass.Expect(x => x.Name).Return("__initmixin");
            __prepareclass.Expect(x => x.ExistsOnServer).Return(true);
            mixin.Methods.Add(__prepareclass);

            IMethod[] allMethods = cls.AllMethods().ToArray();

            Assert.IsEmpty(cls.AllMethods().ToArray());
        }
开发者ID:DamienHauta,项目名称:Ns2Docs,代码行数:16,代码来源:TableTest.cs

示例2: AllMethods

        public void AllMethods()
        {
            Table weapon = new Table("Weapon");
            Table clipWeapon = new Table("ClipWeapon", weapon);

            IMethod getCanIdle = MockRepository.GenerateStub<IMethod>();
            getCanIdle.Expect(x => x.ExistsOnClient).Return(true);
            getCanIdle.Expect(x => x.ExistsOnServer).Return(true);
            weapon.Methods.Add(getCanIdle);

            Assert.Contains(getCanIdle, clipWeapon.AllMethods().ToArray());
        }
开发者ID:DamienHauta,项目名称:Ns2Docs,代码行数:12,代码来源:TableTest.cs

示例3: AllMethods__Include__Mixin__Methods

        public void AllMethods__Include__Mixin__Methods()
        {
            Table mac = new Table("MAC");
            Table upgradeableMixin = new Table("UpgradableMixin");
            mac.Mixins.Add(upgradeableMixin);

            IMethod getUpgrades = MockRepository.GenerateStub<IMethod>();
            getUpgrades.Expect(x => x.Table).Return(upgradeableMixin);
            getUpgrades.Expect(x => x.Name).Return("GetUpgrades");
            getUpgrades.Expect(x => x.ExistsOnServer).Return(true);
            upgradeableMixin.Methods.Add(getUpgrades);

            Assert.AreEqual(getUpgrades, mac.AllMethods().First());
        }
开发者ID:DamienHauta,项目名称:Ns2Docs,代码行数:14,代码来源:TableTest.cs

示例4: AllMethods__Ignore_Overridden_Methods

        public void AllMethods__Ignore_Overridden_Methods()
        {
            Table weapon = new Table("Weapon");
            Table clipWeapon = new Table("ClipWeapon", weapon);

            IMethod getCanIdle_Weapon = MockRepository.GenerateStub<IMethod>();
            getCanIdle_Weapon.Expect(x => x.Name).Return("GetCanIdle");
            getCanIdle_Weapon.Expect(x => x.ExistsOnServer).Return(true);
            weapon.Methods.Add(getCanIdle_Weapon);

            IMethod getCanIdle_ClipWeapon = MockRepository.GenerateStub<IMethod>();
            getCanIdle_ClipWeapon.Expect(x => x.Name).Return("GetCanIdle");
            getCanIdle_ClipWeapon.Expect(x => x.ExistsOnServer).Return(true);
            clipWeapon.Methods.Add(getCanIdle_ClipWeapon);

            IMethod[] allMethods = clipWeapon.AllMethods().ToArray();

            Assert.Contains(getCanIdle_ClipWeapon, allMethods);
            Assert.AreEqual(1, allMethods.Length, "Only contain ClipWeapon:CanIdle() because Weapon:CanIdle() is overridden.");
            Assert.IsFalse(allMethods.Contains(getCanIdle_Weapon));
        }
开发者ID:DamienHauta,项目名称:Ns2Docs,代码行数:21,代码来源:TableTest.cs

示例5: AllMethods__Use_Nearest_Parent_Method_For_Methods_That_Are_Not_Overridden

        public void AllMethods__Use_Nearest_Parent_Method_For_Methods_That_Are_Not_Overridden()
        {
            Table scriptActor = new Table("ScriptActor");
            Table weapon = new Table("Weapon", scriptActor);
            Table clipWeapon = new Table("ClipWeapon", weapon);

            IMethod onCreate_ScriptActor = MockRepository.GenerateStub<IMethod>();
            onCreate_ScriptActor.Expect(x => x.Name).Return("OnCreate");
            onCreate_ScriptActor.Expect(x => x.Table).Return(scriptActor);
            onCreate_ScriptActor.Expect(x => x.ExistsOnServer).Return(true);
            scriptActor.Methods.Add(onCreate_ScriptActor);

            IMethod onCreate_Weapon = MockRepository.GenerateStub<IMethod>();
            onCreate_Weapon.Expect(x => x.Name).Return("OnCreate");
            onCreate_Weapon.Expect(x => x.Table).Return(weapon);
            onCreate_Weapon.Expect(x => x.ExistsOnServer).Return(true);
            weapon.Methods.Add(onCreate_Weapon);

            IEnumerable<IMethod> allMethods = clipWeapon.AllMethods();

            Assert.AreEqual(1, allMethods.Count());
            Assert.AreEqual(onCreate_Weapon, allMethods.First());
        }
开发者ID:DamienHauta,项目名称:Ns2Docs,代码行数:23,代码来源:TableTest.cs


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