I have a test that verifies the collection output of a method. This variation of the test passes:
[TestMethod, TestCategory("BVT")]
public void TheStatusesAreReturned()
{
var expectedUnprocessedStatuses = new List<FileUploadStatus>
{
FileUploadStatus.InProcess,
FileUploadStatus.Pending,
};
Sut.GetUnprocessedStatuses()
.Should()
.BeEquivalentTo(expectedUnprocessedStatuses);
}
This variation of the test fails, with the error "Expected item[0] to be InProcess, but found Pending":
[TestMethod, TestCategory("BVT")]
public void TheStatusesAreReturned2()
{
var expectedUnprocessedStatuses = new List<FileUploadStatus>
{
FileUploadStatus.InProcess,
FileUploadStatus.Pending,
};
Sut.GetUnprocessedStatuses()
.ShouldBeEquivalentTo(expectedUnprocessedStatuses);
}
Clearly, ShouldBeEquivalentTo
cares about collection item order, whereas BeEquivalentTo
does not. Why is the notion of equivalency different between the 2 methods?