The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,737 other followers

Archive for September 8th, 2015

On why there is no Assert.AreEqual(T t1, T t2) where T: IEquatable – via Stack Overflow

Posted by jpluimers on 2015/09/08

On why there is no

Assert.AreEqual<T>(T t1, T t2) where T: IEquatable<T>

Interesting. And I need to give some thought because when calling Assert.AreEqual<T1, T2>(T1 object1, T2 object2) where T1 does not equal T2 will map to Assert.AreEqual(object, object) without compile time warning.

Assert.AreEqual(object, object) ultimately calls Assert.AreEqual<T>(T, T, String, Object[]) which calls Object.Equals(object, object) failing only at run-time.

This has bitten me too many times.

I wonder what NUnit provides here; will look into that later.

–jeroen

via: c# – Microsoft.VisualStudio.TestTools.UnitTesting.Assert generic method overloads behavior – Stack Overflow.

Posted in .NET, Agile, C#, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Development, MSTest, NUnit, Software Development, Testing.NET, Unit Testing, VSTest | Leave a Comment »

 
%d bloggers like this: