public static void AssertTrue(bool condition, string message)
 {
     try
     {
         Assert.True(condition, message);
     }
     catch (AssertionException ex)
     {
         LoggerUtil.Error($"Expected 'true', found {condition}" + ex);
         Assert.Fail();
     }
 }
 public static void AssertNotNull(object targetObject, string message)
 {
     try
     {
         Assert.NotNull(targetObject, message);
     }
     catch (AssertionException ex)
     {
         LoggerUtil.Error($"Expected {targetObject} to be not null, but get" + ex);
         Assert.Fail();
     }
 }
 public static void AssertEquals(object expected, object actual, string message)
 {
     try
     {
         Assert.AreEqual(expected, actual, message);
     }
     catch (AssertionException ex)
     {
         LoggerUtil.Error($"Expected objects to be equal, but get" + ex);
         Assert.Fail();
     }
 }
示例#4
0
 public static void AssertNotNull(object targetObject, string message)
 {
     try
     {
         Assert.NotNull(targetObject, message);
         LoggerUtil.Info("Object is not null");
     }
     catch (AssertionException ex)
     {
         LoggerUtil.Error($"Expected object is not null, but found: {ex}");
         Assert.Fail();
     }
 }
示例#5
0
        public static bool ImageCompareString(Bitmap firstImage, Bitmap secondImage)
        {
            MemoryStream ms = new MemoryStream();

            firstImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            String firstBitmap = Convert.ToBase64String(ms.ToArray());

            ms.Position = 0;

            secondImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
            String secondBitmap = Convert.ToBase64String(ms.ToArray());

            if (firstBitmap.Equals(secondBitmap))
            {
                LoggerUtil.Info("Images are equal");
                return(true);
            }
            LoggerUtil.Error("Images are not equal");
            return(false);
        }