コード例 #1
0
        public void Test_RegisterIfNeeded_WaterNotNeeded()
        {
            var settings = EngineSettings.DefaultVerbose;

            var person = new Person (settings);

            var waterNeed = new DrinkWaterNeedIdentifier (settings, new ConsoleHelper(settings));

            waterNeed.RegisterIfNeeded (person);

            Assert.AreEqual (0, person.Needs.Count);
        }
コード例 #2
0
        public void Test_RegisterIfNeeded_WaterIsNeeded()
        {
            var settings = EngineSettings.DefaultVerbose;

            var person = new Person (settings);
            person.Vitals[PersonVitalType.Thirst] = 80;

            var waterNeed = new DrinkWaterNeedIdentifier (settings, new ConsoleHelper(settings));

            waterNeed.RegisterIfNeeded (person);

            Assert.AreEqual (1, person.Needs.Count);

            var need = person.Needs [0];

            Assert.AreEqual (ActivityVerb.Drink, need.ActionType);
            Assert.AreEqual (ItemType.Water, need.ItemType);
            Assert.AreEqual (settings.DefaultDrinkAmount, need.Quantity);
            Assert.AreEqual (settings.DefaultItemPriorities[ItemType.Water], need.Priority);
        }