예제 #1
0
        public void TestBasicTouch()
        {
            BasicTouch action = new BasicTouch();

            State state = Utility.CreateDefaultState();

            // Test that if not enough CP, we can't use it
            TestBlocks.TestCannotUseWithCP(action, state, 0);

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

            // Test that it uses the correct amount of CP
            Assert.AreEqual <uint>(state.CP - action.RequiredCP, success.CP);
            Assert.AreEqual <uint>(state.CP - action.RequiredCP, failure.CP);

            // Test that it uses the correct amount of durability.
            Assert.AreEqual <uint>(state.Durability - action.BaseDurability, success.Durability);
            Assert.AreEqual <uint>(state.Durability - action.BaseDurability, failure.Durability);

            // Test that failure does not increase quality, but success does.
            Assert.AreEqual <uint>(state.Quality, failure.Quality);
            Assert.AreEqual <uint>(state.Quality + Compute.Quality(state, action.BaseEfficiency), success.Quality);

            // Test that nothing changed except durability, quality, CP, and condition.
            success.Condition  = failure.Condition = state.Condition;
            success.Durability = failure.Durability = state.Durability;
            success.Quality    = failure.Quality = state.Quality;
            success.CP         = failure.CP = state.CP;
            Assert.AreEqual <State>(state, success);
            Assert.AreEqual <State>(state, failure);
        }
예제 #2
0
        public void TestBasicSynthesis()
        {
            BasicSynthesis action = new BasicSynthesis();

            State state = Utility.CreateDefaultState();

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

            // Test that we can use it even with 0 CP
            TestBlocks.TestCanUseWithCP(action, state, 0);

            // Test that it doesn't use any CP
            Assert.AreEqual <uint>(state.CP, success.CP);
            Assert.AreEqual <uint>(state.CP, failure.CP);

            // Test that it uses the correct amount of durability.
            Assert.AreEqual <uint>(state.Durability - action.BaseDurability, success.Durability);
            Assert.AreEqual <uint>(state.Durability - action.BaseDurability, failure.Durability);

            // Test that failure does not increase progress, but success does.
            Assert.AreEqual <uint>(state.Progress, failure.Progress);
            Assert.AreEqual <uint>(state.Progress + Compute.Progress(state, action.BaseEfficiency), success.Progress);

            // Test that nothing changed except durability, progress, and condition.
            success.Condition  = failure.Condition = state.Condition;
            success.Durability = failure.Durability = state.Durability;
            success.Progress   = failure.Progress = state.Progress;
            bool equal = state.Equals(success);

            Assert.AreEqual <State>(state, success);
            Assert.AreEqual <State>(state, failure);
        }