Sorry if this issue already exists, (I tried rephrasing this a couple ways, but I couldn't come up with one that found any results here):
How do I assert that two sets share no elements?
Right now the only method I've got is
ACollection.Intersect(AnotherCollection).Should.BeEmpty("because....");
but the failure result is a little cryptic.
A little bit of context: I've written a command-line app that has a number of supported "commands". Each of those commands has options. The purpose of this test is to ensure that each of the commands dont share any options with the command line utility itself, otherwise there will be ambiguity in its usage.
foreach (var commandType in commandTypes) { var instance = (ICommand) windsor.Resolve(commandType); var commandOptions = instance.OptionSet.SelectMany(option => option.GetNames()); var sharedOptions = rootOptions.Intersect(commandOptions); sharedOptions.Should().BeEmpty("because a command may not share options with the CommandLineUtil " + "but both the utility and the '{0}' have the option(s) '{1}'", instance.GetType().Name, String.Join("', and '", sharedOptions)); }
you get
Expected no items because a command may not share options with the CommandLineUtil but both the util and the 'ClearCommand' have the option(s) '-c', but found 1.
and what I'd really like it to say is
Expected no shared items because the 'ClearCommand' may not share options with the CommandLineUtil, but found '-c'
Am I missing something obvious, or does FluentAssertion have no nice way to assert that two sets are completely divergent?
There is of course
ACollection.Should().NotContain(object stuff....)
but (thankfully --I think the way it is now is the way it should be--) it doesn't do any clever reflection on its parameters to determine if they're enumerable, so
ACollection.Should().NotContain(AnotherCollection, "because...")
simply green-bars.
cheers.