Exemple #1
0
 public RealDuck()
 {
     Actions.Add("quack");
     ActionMethods.Add(Quack);
     Actions.Add("fly");
     ActionMethods.Add(Fly);
 }
Exemple #2
0
    public ActionManager(GameManager manager)
    {
        this.manager = manager;

        actionsQueue = new ActionsQueue(manager);

        methods = new ActionMethods(manager, this);
    }
        public void TryCreateDelegate_ClassWithActionMethod_DelegateTypeIsWrong_ReturnsFalse()
        {
            var obj = new ActionMethods();
            var method = obj.GetType().GetMethod(nameof(obj.SomeAction));

            bool canCreate = method.TryCreateDelegate(obj, out Predicate<int> del);

            Assert.IsFalse(canCreate);
        }
        public void TryCreateDelegate_ClassWithActionMethod_ReturnsTrue()
        {
            var obj = new ActionMethods();
            var method = obj.GetType().GetMethod(nameof(obj.SomeAction));

            bool canCreate = method.TryCreateDelegate(obj, out Action del);

            Assert.IsTrue(canCreate);
        }
Exemple #5
0
 public RubberDuck()
 {
     Actions.Add("squeak");
     ActionMethods.Add(Squeak);
 }