public CustomerUser(Customer customer, User user, bool isDefault) { Id = Guid.NewGuid(); Customer = customer; User = user; IsDefault = isDefault; }
public void should_persist() { var customer = new Customer("Name"); var physicalAddress = new Address("Line1", "Line2", "PostalCode", "City", new Country("South Africa"), "PostalCode", new Province("Limpopo")); var postalAddress = new Address("Line1", "Line2", "PostalCode", "City", new Country("Botswana"), "PostalCode", new Province("Gauteng")); var billing = new Billing("ContactNumber", "ContactPerson", "RegistrationNumber", DateTime.UtcNow, "PastelId", "VatNumber", PaymentType.DebitOrder); var roles = new HashSet<Role>{new Role("Role")}; var user = new User("FirstName", "LastName", "IdNumber", "ContactNumber", "UserName", "Password", false, UserType.Internal, roles); new PersistenceSpecification<Customer>(Session, new CustomEqualityComparer()) .CheckProperty(c => c.Name, "Name") .CheckReference(c => c.AccountOwner, user) .CheckReference(c => c.Billing, billing) .CheckReference(c => c.CommercialState, new CommercialState("CommercialState")) .CheckProperty(c => c.CreateSource, CreateSourceType.Web) .CheckList(c => c.CustomerUsers, new HashSet<CustomerUser> { new CustomerUser(customer, new User(), true) }) .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.Industries, new HashSet<CustomerIndustry> { new CustomerIndustry(customer, Guid.NewGuid()) }) .CheckList(c => c.Addresses, new HashSet<CustomerAddress> { new CustomerAddress(customer, physicalAddress, AddressType.Physical), new CustomerAddress(customer, postalAddress, AddressType.Postal) }) .VerifyTheMappings(customer); }
public CustomerIndustry(Customer customer, Guid industryId) { Id = Guid.NewGuid(); Customer = customer; IndustryId = industryId; }
public CustomerAddress(Customer customer, Address address, AddressType addressType, Guid id = new Guid()) : base(id) { Customer = customer; Address = address; AddressType = addressType; }