Exemple #1
0
        public void ManaComponentShouldRegenerate()
        {
            //Arrange
            var regenAttrMana = new RegenAttribute {
                Name = "Mana", Current = 100, Max = 200, RegenRatePerSecond = 10
            };

            var component = new ManaComponent(new World())
            {
                Mana = regenAttrMana
            };


            GameTime gameTime = new GameTime();

            component.Update(gameTime);
            //Precondition
            component.Mana.Current.Should().Be(100);

            //Act
            gameTime.Elapsed += TimeSpan.FromSeconds(2);
            component.Update(gameTime);

            //Assert
            component.Mana.Current.Should().Be(120);
        }
Exemple #2
0
        public void UpdateSystemShouldGetGameTime()
        {
            //Arrange
            var regenAttrHealth = new RegenAttribute {
                Name = "Health", Current = 100, Max = 200, RegenRatePerSecond = 0.5
            };
            var component = new HealthComponent(new World())
            {
                Health = regenAttrHealth
            };

            GameTime gameTime = new GameTime();

            component.Update(gameTime);
            //Precondition
            component.Health.Current.Should().Be(100);

            //Act
            gameTime.Elapsed += TimeSpan.FromSeconds(2);
            component.Update(gameTime);

            //Assert
            component.Health.Current.Should().Be(101);
        }