public void TestZero() { var resource = new AggressiveLazyValue(0, begin, 0, 0); SystemClock.SetClock(begin.AddHours(12)); Assert.Equal(resource.Value, 0); }
public void TestPositiveUpkeepGreaterThanRate() { var resource = new AggressiveLazyValue(100, begin, 50, 100); SystemClock.SetClock(begin.AddMinutes(30)); Assert.Equal(resource.Value, 75); SystemClock.SetClock(begin.AddMinutes(60)); Assert.Equal(resource.Value, 50); }
public void TestPositiveUpkeep() { var resource = new AggressiveLazyValue(100, begin, 0, 100); SystemClock.SetClock(begin.AddMinutes(30)); Assert.Equal(50, resource.Value); SystemClock.SetClock(begin.AddMinutes(60)); Assert.Equal(0, resource.Value); }
public void TestPositiveRate() { var resource = new AggressiveLazyValue(0, begin, 100, 0); SystemClock.SetClock(begin.AddMinutes(30)); Assert.Equal(resource.Value, 50); SystemClock.SetClock(begin.AddMinutes(60)); Assert.Equal(resource.Value, 100); }
public void TestEqualUpkeepAndRate() { var resource = new AggressiveLazyValue(100, begin, 100, 100); SystemClock.SetClock(begin.AddMinutes(30)); Assert.Equal(resource.Value, 100); SystemClock.SetClock(begin.AddMinutes(60)); Assert.Equal(resource.Value, 100); }
public Forest(uint id, int capacity, uint x, uint y, IActionFactory actionFactory, IScheduler scheduler, IDbManager dbManager, Formula formula) : base(id, x, y) { this.actionFactory = actionFactory; this.scheduler = scheduler; this.dbManager = dbManager; this.formula = formula; Wood = new AggressiveLazyValue(capacity) { Limit = capacity }; }
public void TestChangeRate() { var resource = new AggressiveLazyValue(0, begin, 0, 0); // Set the rate higher SystemClock.SetClock(begin.AddMinutes(30)); resource.Rate = 100; Assert.Equal(resource.Value, 0); // Probe later SystemClock.SetClock(begin.AddMinutes(60)); Assert.Equal(resource.Value, 50); }
public void TestChangeUpkeep() { var resource = new AggressiveLazyValue(100, begin, 100, 0); // Set the upkeep higher SystemClock.SetClock(begin.AddMinutes(30)); resource.Upkeep = 50; resource.Rate = 0; Assert.Equal(resource.Value, 150); // Probe later SystemClock.SetClock(begin.AddMinutes(60)); Assert.Equal(resource.Value, 125); }