public void Should_Add_ModelScope_When_Valid() { var builder = new SpecificationBuilder <MemberClass>(); Predicate <MemberClass> isValid = c => true; builder.Valid(isValid); Assert.Single(builder.Commands); Assert.IsType <ModelScope <MemberClass> >(builder.Commands.Single()); var command = (ModelScope <MemberClass>)builder.Commands.Single(); Assert.Equal("Valid", command.Name); Assert.Null(command.RuleSingleError); Assert.Same(isValid, command.Rule.IsValid); Assert.Null(command.Rule.RuleSingleError); Assert.Null(command.Rule.Error); }
public void Should_ThrowException_When_Valid_And_NullPredicate() { var builder = new SpecificationBuilder <MemberClass>(); Assert.Throws <ArgumentNullException>(() => { builder.Valid(null); }); }