コード例 #1
0
        public void TestManipulation()
        {
            Manipulation   manipulation = new Manipulation();
            BasicSynthesis basic        = new BasicSynthesis();
            SteadyHand     steadyHand   = new SteadyHand();

            State state = Utility.CreateDefaultState();

            state.Durability    = 30;
            state.MaxDurability = 60;

            // Verify that Manipulation can be activated successfully.
            State s1 = manipulation.Activate(state, true);

            Assert.AreEqual <uint>(manipulation.Duration, Manipulation.GetTurnsRemaining(s1));

            // Verify that the durability has not changed simply as a result of activating manipulation.
            Assert.AreEqual <uint>(state.Durability, s1.Durability);

            // Verify that Manipulation can't be used if it's already up.
            Assert.IsFalse(manipulation.CanUse(s1));

            // Verify that using Basic Synthesis with Manipulation up doesn't decrease the durability.
            State s2 = basic.Activate(s1, true);

            Assert.AreEqual <uint>(s1.Durability, s2.Durability);
            Assert.AreEqual <uint>(2, Manipulation.GetTurnsRemaining(s2));
            Assert.IsFalse(manipulation.CanUse(s2));

            // Verify that using Steady hand with Manipulation up causes the durability to increase by 10.
            State s3 = steadyHand.Activate(s2, true);

            Assert.AreEqual <uint>(s2.Durability + 10, s3.Durability);
            Assert.AreEqual <uint>(1, Manipulation.GetTurnsRemaining(s3));
            Assert.IsFalse(manipulation.CanUse(s3));

            // Use another Basic Synthesis so we can verify that the buff de-activates.
            State s4 = basic.Activate(s3, true);

            Assert.IsTrue(manipulation.CanUse(s4));
        }