public IExpectAlternateContact WithPrimaryContact <T>(IBuildingSpecification <T> primaryContactSpec) where T : IContactInfo { if (primaryContactSpec == null) { throw new ArgumentNullException(); } ConvertingSpecification <IContactInfo, T> convertedSpec = new ConvertingSpecification <IContactInfo, T>(primaryContactSpec); return(new PersonSpecification() { Name = this.Name, Surname = this.Surname, ContactSpecs = new[] { convertedSpec }, PrimaryContactSpec = convertedSpec }); }
public IExpectAlternateContact WithAlternateContact <T>(IBuildingSpecification <T> contactSpec) where T : IContactInfo { if (!this.CanAdd(contactSpec)) { throw new ArgumentException(); } ConvertingSpecification <IContactInfo, T> convertedSpec = new ConvertingSpecification <IContactInfo, T>(contactSpec); return(new PersonSpecification() { Name = this.Name, Surname = this.Surname, ContactSpecs = new List <IBuildingSpecification <IContactInfo> >(this.ContactSpecs) { convertedSpec }, PrimaryContactSpec = this.PrimaryContactSpec }); }