public void should_persist() { var physicalAddress = new Address("Line1", "Line2", "PostalCode", "City", new Country("South Africa"), "PostalCode", new Province("Gauteng")); var postalAddress = new Address("Line1", "Line2", "PostalCode", "City", new Country("Botswana"), "PostalCode", new Province("KZN")); var client = new Client("Client"); new PersistenceSpecification<Client>(Session, new CustomEqualityComparer()) .CheckProperty(c => c.Name, "Client") .CheckList(c => c.Contracts, new HashSet<Contract> { new Contract(DateTime.UtcNow, "Name", "Detail", "By", DateTime.UtcNow, "RegisteredName", "Reg#", new ContractType("Type"), EscalationType.AnnualPercentageAllProducts, ContractDuration.Custom) }) .CheckList(c => c.UserAliases, new HashSet<ClientUserAlias> { new ClientUserAlias() }) .CheckList(c => c.Industries, new List<ClientIndustry> { new ClientIndustry(client, Guid.NewGuid()) }) .CheckList(c => c.Addresses, new HashSet<ClientAddress> { new ClientAddress(client, physicalAddress, AddressType.Physical), new ClientAddress(client, postalAddress, AddressType.Postal) }) .VerifyTheMappings(client); }
public ClientAddress(Client client, Address address, AddressType addressType, Guid id = new Guid()) : base(id) { Client = client; Address = address; AddressType = addressType; }
public ClientIndustry(Client client, Guid industryId) { Id = Guid.NewGuid(); Client = client; IndustryId = industryId; }