コード例 #1
0
        // No rate or upkeep for 1 hr should return 0
        // No rate or upkeep for 10 min should return 0
        // Rate of 10 for 10 min should return 1
        // Rate of 60 for 10 min should return 10
        // Rate of 60 for 1 hour should return 60
        // Rate of 60 with 30 upkeep for 1 hour should return 30
        // Rate of 60 with 30 upkeep for 30 min should return 15
        // Rate of 30 with 60 upkeep for 30 min should return -15
        // Rate of 11 with 60 upkeep for 30 min should return -24
        // Rate of 60 with 30 upkeep for 1 hour should return -30
        // Rate of 30 with 30 upkeep for 1 hour should return
        // The last value should technically be 283 but decimal is giving 282.99999999 which when casted to an int truncates
        public void TestGetAmountReceived(int interval, int rate, int upkeep, int expected)
        {
            var resource = new LazyValue(0, DateTime.MinValue, rate, upkeep);

            resource.GetAmountReceived(interval).Should().Be(expected);
        }