(); } public override bool Equals(object obj) { // is never called return obj != null && Name== obj.Name; } } [Fact] public void Equal_AssertEqual_NotEqual() { var first = new ComponentViewModel {Name = "1"}; var second = new ComponentViewModel {Name = "2"}; Assert.Not...
xUnit.net assertion library for sub-module purposes (please open issues in https://github.com/xunit/xunit) - assert.xunit/EqualityAsserts.cs at main · xunit/assert.xunit
public void testWithoutConditionals() throws Exception { String expectedLastname = "smith"; List foundPeople = PeopleFinder.findPeopleWithLastname(expectedLastname); assertNotNull("found people", foundPeople); assertEquals( "number of people", 1, foundPeople.size() ); Person solePerson = (...
Example assertTrueWithoutMessage embedded from java/com/xunitpatterns/misc/SampleAssertionUsage.javaThis emits a failure message something like "Assertion Failed". From this, we cannot even tell which of the two Assertion Messages has failed. Not very useful, is it?
("This is an override of Object.Equals(). Call Assert.Equal() instead.", true)] [EditorBrowsable(EditorBrowsableState.Never)] public static new bool Equals( object a, object b) { throw new InvalidOperationException("Assert.Equals should not be used"); } /// <summary>Do not call this ...
I'd love to see feature parity with MSUnit and NUnit, which both already support overloads for equality with user-specified messages. I believe a new overload in EqualException would be required: public EqualException(object expected, ob...
The thing to add then to xUnit is a function to easily create an equality comparer from a tolerance. Off the top of my head, maybe that syntax would be EqualityComparer.WithTolerance(0.001), in which case, the whole assertion would look like Assert.Equal(Math.PI, 3.14159, EqualityComparer....
xUnit.net assertion library for sub-module purposes (please open issues in https://github.com/xunit/xunit) - xunit/xunit#2795: Collection equality regression with custom comparer… · baywet/assert.xunit@28ab73f
public new static bool Equals(object a, object b) { throw new InvalidOperationException("Assert.Equals should not be used"); } /// <summary>Do not call this method.</summary> [Obsolete("This is an override of Object.Equals(). Call Assert.Equal() instead.", true)] [EditorBrowsable(Edi...
$this->assertEqual($expected, $actual, "", 0.01); } public function test_elapsed_time_is_positive_if_started() { $timespan = new MilliTimespan(); $timespan->startTimer(); usleep(100); $timespan->stopTimer(); $elapsedTime = $timespan->getElapsedTimeInMilliSec(); $this->assertFirst...