OneOf

ShouldBeOneOf

var apu = new Person { Name = "Apu" };
var homer = new Person { Name = "Homer" };
var skinner = new Person { Name = "Skinner" };
var barney = new Person { Name = "Barney" };
var theBeSharps = new List<Person> { homer, skinner, barney };
apu.ShouldBeOneOf(theBeSharps.ToArray());

snippet source | anchor

Exception

apu
    should be one of
[Homer, Skinner, Barney]
    but was
Apu

ShouldNotBeOneOf

var apu = new Person { Name = "Apu" };
var homer = new Person { Name = "Homer" };
var skinner = new Person { Name = "Skinner" };
var barney = new Person { Name = "Barney" };
var wiggum = new Person { Name = "Wiggum" };
var theBeSharps = new List<Person> { apu, homer, skinner, barney, wiggum };
wiggum.ShouldNotBeOneOf(theBeSharps.ToArray());

snippet source | anchor

Exception

wiggum
    should not be one of
[Apu, Homer, Skinner, Barney, Wiggum]
    but was
Wiggum

Last updated