public void Should_Add_AsModelRule_When_AsModel_When_NullSpecification() { var builder = new MemberSpecificationBuilder <object, MemberClass>(); builder.AsModel(); Assert.Single(builder.Commands); Assert.IsType <AsModelRule <MemberClass> >(builder.Commands.Single()); var command = (AsModelRule <MemberClass>)builder.Commands.Single(); Assert.Equal("AsModel", command.Name); Assert.Null(command.RuleSingleError); Assert.Null(command.Specification); }
public void Should_Add_AsModelRule_When_AsModel_And_SpecificationDefined() { var builder = new MemberSpecificationBuilder <object, MemberClass>(); var specification = new Specification <MemberClass>(x => x); builder.AsModel(specification); Assert.Single(builder.Commands); Assert.IsType <AsModelRule <MemberClass> >(builder.Commands.Single()); var command = (AsModelRule <MemberClass>)builder.Commands.Single(); Assert.Equal("AsModel", command.Name); Assert.Null(command.RuleSingleError); Assert.Same(specification, command.Specification); Assert.Equal(specification.GetHashCode().ToString(), command.SpecificationId); }