public void Test_Build_CompleteConstruction() { Console.WriteLine (""); Console.WriteLine ("Preparing test"); Console.WriteLine (""); var settings = EngineSettings.DefaultVerbose; settings.ConstructionRate = 10; var person = new Person (settings); person.Home = new Building (BuildingType.Shelter, settings); person.Home.Inventory.Items [ItemType.Timber] = settings.ShelterTimberCost; person.Home.PercentComplete = 99; var needEntry = new NeedEntry (ActivityVerb.Build, ItemType.Shelter, PersonVitalType.NotSet, 1, 100); person.AddNeed (needEntry); var activity = new BuildShelterActivity (person, needEntry, settings, new ConsoleHelper(settings)); activity.Shelter = person.Home; activity.Act (person); Assert.AreEqual (100, person.Home.PercentComplete); Assert.IsTrue (person.Home.IsCompleted); Assert.AreEqual (0, person.Needs.Count); }
// TODO: Remove if not needed //[Test] public void Test_Decide_ShelterNeeded() { var person = new Person (); person.AddNeed(ItemType.Shelter, 1, 100); var decision = new ShelterDecision (EngineSettings.DefaultVerbose); decision.Decide (person); var expectedName = typeof(BuildShelterActivity).Name; var foundName = person.Activity.GetType ().Name; Assert.AreEqual(expectedName, foundName); }
public void RegisterNeedForWood(Person person, decimal quantity) { var amountOfWoodNeeded = CalculateAmountOfWoodNeeded (NeedEntry.Quantity); if (Settings.IsVerbose) Console.WriteDebugLine (" Registering the need to " + ActivityVerb.Fell + " " + amountOfWoodNeeded + " wood"); person.AddNeed (ActivityVerb.Fell, PersonVitalType.NotSet, ItemType.Wood, amountOfWoodNeeded, NeedEntry.Priority+1); }