Exemplo n.º 1
0
        public string AddDyeToBunny(string bunnyName, int power)
        {
            Dye dye = new Dye(power);

            if (bunnies.FindByName(bunnyName) == null)
            {
                throw new InvalidOperationException("The bunny you want to add a dye to doesn't exist!");
            }

            bunnies.FindByName(bunnyName).AddDye(dye);

            return($"Successfully added dye with power {dye.Power} to bunny {bunnyName}!");
        }
Exemplo n.º 2
0
        public string AddDyeToBunny(string bunnyName, int power) //ok?
        {
            IBunny bunny = bunnies.FindByName(bunnyName);

            if (bunny == null)
            {
                throw new InvalidOperationException(string.Format(ExceptionMessages.InexistentBunny));
            }
            Dye dye = new Dye(power);

            bunny.AddDye(dye);
            return($"Successfully added dye with power {power} to bunny {bunnyName}!");
        }
Exemplo n.º 3
0
        public string AddDyeToBunny(string bunnyName, int power)
        {
            IBunny currentBunny = bunnies.FindByName(bunnyName);

            if (currentBunny == null)
            {
                throw new InvalidOperationException(ExceptionMessages.InexistentBunny);
            }
            IDye currentDye = new Dye(power);

            currentBunny.AddDye(currentDye);
            return($"{String.Format(OutputMessages.DyeAdded, power, bunnyName)}");
        }
Exemplo n.º 4
0
        public string AddDyeToBunny(string bunnyName, int power)
        {
            Dye    dye   = new Dye(power);
            IBunny bunny = bunnies.FindByName(bunnyName);

            if (bunny == null)
            {
                throw new InvalidOperationException(ExceptionMessages.InexistentBunny);
            }

            bunny.AddDye(dye);
            return(string.Format(OutputMessages.DyeAdded, power, bunnyName));
        }