Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 104959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:21:49+00:00 2026-05-11T01:21:49+00:00

I love to Extend my Assert.AreEqual to many different classes, the known one is

  • 0

I love to Extend my Assert.AreEqual to many different classes, the known one is the CollectionAssert of course, but I can think of some more such as: ImageAssert, XmlAssert etc..

Did you Create your own Assert classes? and what kind of new would you like to create?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:21:49+00:00Added an answer on May 11, 2026 at 1:21 am

    I’ve just added an implementation to ImageAssert as I wrote above (in my question) I would be glad to hear more of that kind of samples

    [TestMethod] public void CompareImagesSize() {  Image expected = Bitmap.FromFile(@'C:\ShaniData\Projects2008\TddSamples\Output\ExpectedImage.png');  Image actual = Bitmap.FromFile(@'C:\ShaniData\Projects2008\TddSamples\Output\RhinoDiagram.png');   Bitmap expectedBitmap = new Bitmap(expected);  Bitmap actualBitmap = new Bitmap(actual);   ImageAssert.HasTheSameSize(expectedBitmap, actualBitmap); }  [TestMethod] public void CompareTwoSameImagesButWithDifferenExtension() {  Image expected = Bitmap.FromFile(@'C:\ShaniData\Projects2008\TddSamples\Output\Image2.png');  Image actual = Bitmap.FromFile(@'C:\ShaniData\Projects2008\TddSamples\Output\Image1.jpg');   Bitmap expectedBitmap = new Bitmap(expected);  Bitmap actualBitmap = new Bitmap(actual);   ImageAssert.AreEqual(expectedBitmap, actualBitmap); }  public class ImageAssert {     //public static void MoreMethods(Bitmap expected, Bitmap actual)     //{     //    //Compare image extensions     //    //Compare Thumbnail...     //}      public static void HasTheSameSize(Bitmap expected, Bitmap actual)     {         if ((expected.Height != actual.Height)             || (expected.Width != actual.Width))             HandleFail('ImageAssert.HasTheSameSize', String.Empty);     }      public static void AreEqual(Bitmap expected, Bitmap actual)     {         for (int i = 0; i < expected.Width; i++)         {             for (int j = 0; j < expected.Height; j++)             {                 Color expectedBit = expected.GetPixel(i, j);                 Color actualBit = actual.GetPixel(i, j);                 if (!expectedBit.Equals(actualBit))                 {                     HandleFail('ImageAssert.AreEqual', String.Empty, i, j);                     return;                 }             }         }     }      internal static void HandleFail(string assertionName, string message, params object[] parameters)     {         throw new AssertFailedException(String.Format(assertionName));     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I love making fluid layouts, but as we all know, one of its problems
I love the flexibility of named branches but I have some concerns about the
I love vim, but one common gotcha is: yank a line go to where
I love vim and the speed it gives me. But sometimes, my fingers are
I love the way I can profile a Java/.Net app to find performance bottlenecks
I love scaffolding and it extremely helpful for prototyping. But Should we use scaffolding
I love the Hash implementation of Ruby where you can initialize the Hash object
Need some advice about a best-approach for this problem: I've fallen madly in love
I love programming languages and trying to think of logical solutions to problems. A
Morning, I would love help with my specific code but if you're busy any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.