public void UnpackTest_20MoneyAlwaysGainedByNerd_NerdMustHave20Money()
        {
            // Arrange
            RobotNerd rn        = new RobotNerd();
            var       cargoMock = new Mock <Cargo>();
            int       expected  = 20;

            // Act
            DecoratorEncoded de = new DecoratorEncoded(cargoMock.Object);

            de.Value = 20;
            de.Unpack(rn);
            int result = rn.TotalMoney;

            // Assert
            Assert.AreEqual(expected, result);
        }
示例#2
0
        public void CreateCargos()
        {
            //Cargos.Clear();
            //for (int i = 0; i < 3; i++)
            //{
            Cargo cargo = new CommonCargo();

            Random random = new Random(Guid.NewGuid().GetHashCode());
            int    chance = random.Next(1, 11);

            if (chance <= 2)
            {
                cargo = new DecoratorToxic(cargo);
            }
            else if (chance > 2 && chance <= 4)
            {
                cargo = new DecoratorEncoded(cargo);
            }
            Cargos.Add(cargo);
            //}
        }