public void Build_CallsPresent_Succeeds()
        {
            // Arrange
            var builder = new ActionContainerBuilder()
                          .WithIncreaseAttack()
                          .WithDefenceValueTransform(v => v + 1)
                          .WithSpeedValueTransform(v => v + 2)
                          .WithDamagePowerTransform(v => v + 3)
                          .WithTaggedAction(Mock.Of <IAction>(), "mtg");

            // Act
            var container = builder.Build();

            // Assert
            Assert.That(container, Is.Not.Null);
        }
Пример #2
0
        /// <summary>
        /// Returns an action container.
        /// </summary>
        public static ActionContainer CreateActionContainer(
            StatValueTransform[] attackValueTransforms  = null,
            StatValueTransform[] defenceValueTransforms = null,
            StatValueTransform[] speedValueTransforms   = null,
            PowerTransform[] damagePowerTransforms      = null)
        {
            var builder = new ActionContainerBuilder();

            if (attackValueTransforms is not null)
            {
                foreach (var t in attackValueTransforms)
                {
                    builder = builder.WithAttackValueTransform(t);
                }
            }

            if (defenceValueTransforms is not null)
            {
                foreach (var t in defenceValueTransforms)
                {
                    builder = builder.WithDefenceValueTransform(t);
                }
            }

            if (speedValueTransforms is not null)
            {
                foreach (var t in speedValueTransforms)
                {
                    builder = builder.WithSpeedValueTransform(t);
                }
            }

            if (damagePowerTransforms is not null)
            {
                foreach (var t in damagePowerTransforms)
                {
                    builder = builder.WithDamagePowerTransform(t);
                }
            }

            return(builder.Build());
        }