Re: Is.All.EqualTo?

"Charlie Poole" <[email protected]>
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <002701c87fcc$1e726ad0$6401a8c0@ferrari>
Hi Kelly,

I copied the list 'cause it's probably interesting to others... 

>   I think I may be missing something here in the constraint syntax...
> Or perhaps there is a usability weirdness... Here is a part of my
> test:
> 
>         List<int> firstMaxBFF = maxBffLoudList[0] as List<int>;
>         List<int> maxBFF = maxBffLoudList[i] as List<int>;
>         Assert.That(firstMaxBFF, Is.All.EqualTo(maxBFF)," 
> max_bff_loud not equivalent between:" + maxBffNameList[0] + " 
> and " + maxBffNameList[i]);
> 
> And this is the output:
> 
> TestCase 
> 'Sonic.Inspectre.JayRules.MaxBFFLoudSameForAllExistingPrograms
> (C:\src\kanderson\DataFiles\specs\spec_1032_ACTS_II.xml)'
> failed:
>    max_bff_loud not equivalent between:Directional and 
> Hybrid_Directional
>   Expected: all items < 90, 90, 90, 108, 106, 106, 107, 99, 85, 71 >
>   But was: < 90, 90, 90, 108, 106, 106, 107, 99, 85, 71 >
> 	
> C:\src\kanderson\Libraries\Spectre\InspectreTests\JayRules.cs(266,0):
> at 
> Sonic.Inspectre.JayRules.MaxBFFLoudSameForAllExistingPrograms(Object
> current)
> 
> 
> All the numbers are the same in both collections, but  it fails...
> what am I missing here? This doesn't seem intuitive somehow.

You are asserting that /every/ item in firstMaxBFF is equal to
the list in MaxBFF - in other words, that firstMaxBFF is a list
of lists.

What you probably want to do is lots simpler...
  Assert.That( firstMaxBFF, Is.EqualTo( maxBFF ) );

or even simpler...
  Assert.That(  maxBffLoudList[0], Is.EqualTo(  maxBffLoudList[i] ) );

Charlie



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.