Hello
Im currently using nightly build 3.3.668.0 x86
Trying to test some Web services results. Those are not so complex objects
with strict schema so comparing current response with one serialized on
disk in XML and deserialized during the test was natural choice.
I like the idea of StructuralEqualityComparer so i decided to give it a
try. Everything worked nice until i added collections into the mix.
Here is my comparer:
protected readonly IEqualityComparer<FinancialStatementDTO>
FinancialStatementComparer = new
StructuralEqualityComparer<FinancialStatementDTO>
{
{ x => x.ClientInfo, new
StructuralEqualityComparer<ClientInfoDTO>
{
x => x.CisId,
x => x.AdditionalInfo
}
},
{ x => x.Header, new
StructuralEqualityComparer<FinancialStatementHeaderDTO>
{
x => x.Id,
x => x.Year,
x => x.Month,
x => x.EconomicMonth,
x => x.FormatIdent,
x => x.TypeIdent,
x => x.CurrencyIdent,
x => x.CreateDate,
x => x.Note
}
},
{ x => x.Data, new StructuralEqualityComparer<FsDataDTO>()
{
*// unfortuanately doesnt work*
x => x.Items,
x => x.FreeItems
}
}
};
Problem is last comparer. x.Items and x.FreeItems are arrays of objects.
Test result is always: *Both values look the same when formatted but they
are distinct instances.*
Documentation says *Although the equality
assertions<http://www.gallio.org/wiki/doku.php?id=mbunit:assertions:equality>work
nicely with enumerations natively, you may find more convenient to use
the dedicated collection
assertions<http://www.gallio.org/wiki/doku.php?id=mbunit:assertions:collection>
*Doesn't seem to me like "working nicely". Both objects are same for sure
(comparing XML serialised instances as text) but MbUnit seems to still
using identity comparison....
I would like to use collection assertions but problem is that equality
comparison logic contained in those cannot be used outside those assertions
(for example in structural comparer)
Any idea?
Thx
Michal
**
--
You received this message because you are subscribed to the Google Groups
"MbUnit.User" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/mbunituser/-/LHLITW0QXloJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/mbunituser?hl=en.