Exemplo n.º 1
0
 void AssertEquals <T>(T[] expected, T[] actual)
 {
     if (expected == null)
     {
         if (actual != null)
         {
             Assert.Fail("Expected null but got {0}", Sos.SerializeObject(actual));
         }
     }
     else if (actual == null)
     {
         Assert.Fail("Expected {0} but got null", Sos.SerializeObject(expected));
     }
     else
     {
         if (expected.Length != actual.Length)
         {
             Assert.Fail("Expected array of length {0} but actual was length {1} (expected {2}, actual {3})",
                         expected.Length, actual.Length, Sos.SerializeObject(expected), Sos.SerializeObject(actual));
         }
         for (int i = 0; i < expected.Length; i++)
         {
             if (!expected[i].Equals(actual[i]))
             {
                 Assert.Fail("Array mismatch at index {0} (expected {1}, actual {2})", i, Sos.SerializeObject(expected), Sos.SerializeObject(actual));
             }
         }
     }
 }