本文整理汇总了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());
}
示例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());
}
示例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());
}
示例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));
}
示例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());
}