Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
 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);
         }
     }
 }