Exemple #1
0
        public void TestZero()
        {
            var resource = new AggressiveLazyValue(0, begin, 0, 0);

            SystemClock.SetClock(begin.AddHours(12));
            Assert.Equal(resource.Value, 0);
        }
Exemple #2
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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        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
            };
        }
Exemple #7
0
        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);
        }
Exemple #8
0
        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);
        }