Ejemplo n.º 1
0
        public void TestStepIncrement()
        {
            Engine.Ability action = new Engine.BasicSynthesis();
            State          state  = Utility.CreateDefaultState();

            Assert.AreEqual <uint>(1, state.Step);

            State success = action.Activate(state, true);
            State failure = action.Activate(state, false);

            Assert.AreEqual <uint>(2, success.Step);
            Assert.AreEqual <uint>(2, failure.Step);
        }
Ejemplo n.º 2
0
        public void TestObserve()
        {
            Engine.Ability observe = new Engine.Observe();
            Engine.Ability basic   = new Engine.BasicSynthesis();

            State state = Utility.CreateDefaultState();

            // Test that Observe can't be used first.
            Assert.IsFalse(observe.CanUse(state));

            // Use Basic Synthesis so that observe becomes useable.
            state = basic.Activate(state, true);

            // Test the condition requirement for Observe
            state.Condition = Condition.Poor;
            Assert.IsTrue(observe.CanUse(state));
            state.Condition = Condition.Normal;
            Assert.IsFalse(observe.CanUse(state));
            state.Condition = Condition.Good;
            Assert.IsFalse(observe.CanUse(state));
            state.Condition = Condition.Excellent;
            Assert.IsFalse(observe.CanUse(state));

            // Test that observe can't be run twice in a row.
            state.Condition = Condition.Poor;
            Assert.IsTrue(observe.CanUse(state));
            State newState = observe.Activate(state, true);

            // Make sure Observe uses the right amount of CP.
            Assert.AreEqual <uint>(state.CP - observe.RequiredCP, newState.CP);
        }