Пример #1
0
        public void Tamagotchi_Dead_DoNothing()
        {
            var rules = new Rule[]
            {
                new AthleticRule(),
                new BordedomRule(),
                new CrazinessRule(),
                new FatigueRule(),
                new HungerRule(),
                new IsolationRule(),
                new MuchiesRule(),
                new SleepDeprivationRule(),
                new StarvationRule()
            };

            rules = rules.OrderBy(r => r.Order).ToArray();

            Tamagotchi t1 = new Tamagotchi("test", rules);

            t1.HasDied = true;

            var now = DateTime.UtcNow + TimeSpan.FromHours(2);

            Assert.IsFalse(t1.EatAction(now));
            Assert.IsFalse(t1.RefreshRules(now));

            Assert.AreNotEqual(t1.LastAllRulesPassedUtc, now);
        }
Пример #2
0
        public void Tamagotchi_Dead_DoNothing()
        {
            var rules = new Rule[]
            {
                new AthleticRule(),
                new BordedomRule(),
                new CrazinessRule(),
                new FatigueRule(),
                new HungerRule(),
                new IsolationRule(),
                new MuchiesRule(),
                new SleepDeprivationRule(),
                new StarvationRule()
            };

            rules = rules.OrderBy(r => r.Order).ToArray();

            Tamagotchi t1 = new Tamagotchi("test", rules);

            t1.HasDied = true;

            var now = DateTime.UtcNow + TimeSpan.FromHours(2);

            Assert.IsFalse(t1.EatAction(now));
            Assert.IsFalse(t1.RefreshRules(now));

            Assert.AreNotEqual(t1.LastAllRulesPassedUtc, now);
        }
Пример #3
0
        public void TamagotchiAction_EatValue()
        {
            Tamagotchi t = new Tamagotchi(0, 0, 10, 0, new DateTime(1994, 1, 5, 10, 10, 10), TimeSpan.Zero);

            t.EatAction(new DateTime(1994, 1, 5, 10, 10, 10));

            Assert.AreEqual(0, t.Hunger);
        }
Пример #4
0
        public void TamagotchiAction_EatValue()
        {
            Tamagotchi t = new Tamagotchi(0, 0, 10, 0, new DateTime(1994, 1, 5, 10, 10, 10), TimeSpan.Zero);

            t.EatAction(new DateTime(1994, 1, 5, 10, 10, 10));

            Assert.AreEqual(0, t.Hunger);
        }
Пример #5
0
        public void TamagotchiAction_EatDoNothingInCooldown()
        {
            var        dateTime = new DateTime(1994, 1, 5, 10, 10, 10);
            Tamagotchi t        = new Tamagotchi(10, 10, 10, 10, dateTime, new TimeSpan(1));

            Assert.IsFalse(t.EatAction(dateTime));
            Assert.AreEqual(10, t.Hunger);
        }
Пример #6
0
        public void TamagotchiAction_EatDoNothingInCooldown()
        {
            var dateTime = new DateTime(1994, 1, 5, 10, 10, 10);
            Tamagotchi t = new Tamagotchi(10,10,10,10, dateTime, new TimeSpan(1));

            Assert.IsFalse(t.EatAction(dateTime));
            Assert.AreEqual(10, t.Hunger);
        }
Пример #7
0
        public void TamagotchiAction_EatValue()
        {
            var        dateTime = new DateTime(1994, 1, 5, 10, 10, 10);
            Tamagotchi t        = new Tamagotchi(0, 0, 10, 0, DateTime.MinValue, TimeSpan.Zero);

            Assert.IsTrue(t.EatAction(dateTime));

            Assert.AreEqual(dateTime, t.LastAccessedOnUtc);
            Assert.AreEqual(new TimeSpan(0, 0, 30), t.CoolDown);
            Assert.IsTrue(t.IsInCoolDown(dateTime + new TimeSpan(0, 0, 10)));
        }
Пример #8
0
        public void TamagotchiAction_EatValue()
        {
            var dateTime = new DateTime(1994, 1, 5, 10, 10, 10);
            Tamagotchi t = new Tamagotchi(0, 0, 10, 0, DateTime.MinValue, TimeSpan.Zero);

            Assert.IsTrue(t.EatAction(dateTime));

            Assert.AreEqual(dateTime, t.LastAccessedOnUtc);
            Assert.AreEqual(new TimeSpan(0,0,30), t.CoolDown);
            Assert.IsTrue(t.IsInCoolDown(dateTime + new TimeSpan(0, 0, 10)));
        }