On behalf of James Foster:
I came across the same issue with the tutorial (currently working
through it).
I don't think this is actually testing what it says it's testing.
> var controllersWithWrongName = InstallerTestHelper.GetHandlersFor(typeof(IController), container)
> .Where(c => c.ComponentModel.Services.Any(s => s != c.ComponentModel.Implementation))
> .ToArray();
> Assert.Empty(controllersWithWrongName);
all you're saying here is that the ComponentModel.Services doesn't
contain a type that isn't the Implementation.
you're NOT saying that the ComponentModel.Services actually contains
the Implementation. This test passes even if the Services list is
empty.
I think to be correct it would be something like the following...
var controllersWithWrongName =
InstallerTestHelper.GetHandlersFor(typeof(IController), container)
.Where(c => !
c.ComponentModel.Services.
SequenceEquals(new []
{c.ComponentModel.Implementation}))
.ToArray();
Assert.Empty(controllersWithWrongName);
in english: "where the ComponentModel.Services does not equal the list
containing only the Implementation"
Cheers
James