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)}"); }
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}!"); }
public string AddDyeToBunny(string bunnyName, int power) { IBunny bunny = bunnies.FindByName(bunnyName); if (bunny == null) { throw new InvalidOperationException("The bunny you want to add a dye to doesn't exist!"); } bunny.AddDye(new Dye(power)); return($"Successfully added dye with power {power} to bunny {bunnyName}!"); }
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)); }