Ejemplo n.º 1
0
        public void CurrencyEvent_CurrencyAdded()
        {
            var       name     = MUtils.GetRandomString();
            ICurrency currency = new MCurrency(name);

            MEvents.Add(new MEvents.EventDelegate <CurrencyAddedEvent>(e => Debug.Log(e.Currency.Name)));

            currency.Add(5);

            LogAssert.Expect(LogType.Log, name);
        }
Ejemplo n.º 2
0
        public void CurrencyEvent_UpgradableCurrencyUpgraded()
        {
            var name     = MUtils.GetRandomString();
            var capacity = new CappedCurrencyCapacity(5, 10);
            IUpgradableCurrency currency = new MCappedCurrency(name, capacity);

            MEvents.Add(new MEvents.EventDelegate <UpgradableCurrencyUpgradeSuccessEvent>((e => { Debug.Log(e.Currency.Name); })));

            currency.TryUpgradeCapacity();

            LogAssert.Expect(LogType.Log, name);
        }
Ejemplo n.º 3
0
        public void CurrencyEvent_CurrencyInsufficient()
        {
            var       name     = MUtils.GetRandomString();
            ICurrency currency = new MCurrency(name);

            MEvents.Add(new MEvents.EventDelegate <CurrencyInsufficientEvent>((e => { Debug.Log(e.AmountAttempted); })));

            currency.Add(5);
            currency.TrySpend(7);

            LogAssert.Expect(LogType.Log, "7");
        }
Ejemplo n.º 4
0
        public void RemovingEventListener()
        {
            MEvents.Add <TestEvent>(TestEventListener);

            MEvents.RaiseEvent(new TestEvent(1));
            LogAssert.Expect(LogType.Log, "TestEvent" + 1);

            MEvents.Remove <TestEvent>(TestEventListener);
            MEvents.RaiseEvent(new TestEvent(1));

            LogAssert.NoUnexpectedReceived();
        }
 public StatMAchievementTest(int objectiveTarget, string name = "", string description = "") : base(name,
                                                                                                    description, objectiveTarget)
 {
     MEvents.Add <TestEvent>(AchievementProgressed);
 }
Ejemplo n.º 6
0
 public void RaisingEvent()
 {
     MEvents.Add <TestEvent>(TestEventListener);
     MEvents.RaiseEvent(new TestEvent(0));
     LogAssert.Expect(LogType.Log, "TestEvent0");
 }