static private void CreateAdditionalToysTest(ToysSquareSample square) { try { square.AddToyToSquare(Submarine.CreateSampleSubmarine()); square.AddToyToSquare(Computer.CreateSampleComputer()); } catch (ValueExceedException ex) { Console.Error.WriteLine(ex.Message); } catch (ToysAmountExceedException ex) { Console.Error.WriteLine(ex.Message); } }
static private void AddToysListToSquareSampleTest(ToysSquareSample square, ICollection <IToy> toys) { foreach (IToy toy in toys) { try { square.AddToyToSquare(toy); } catch (ValueExceedException ex) { Console.Error.WriteLine(ex.Message); } catch (ToysAmountExceedException ex) { Console.Error.WriteLine(ex.Message); } } }