protected override void OnSetUp() { using (var session = OpenSession()) using (var transaction = session.BeginTransaction()) { var clientA = new Client { Name = "Albert" }; var clientB = new Client { Name = "Bob" }; var corpA = new CorporateClient { Name = "Alpha", CorporateId = "1234" }; var corpB = new CorporateClient { Name = "Beta", CorporateId = "5647" }; var clientZ = new Client { Name = null }; // A null value should propagate if the entity is non-null session.Save(clientA); session.Save(clientB); session.Save(corpA); session.Save(corpB); session.Save(clientZ); session.Save(new Project { Name = "A", BillingClient = null, CorporateClient = null, Client = clientA }); session.Save(new Project { Name = "B", BillingClient = null, CorporateClient = null, Client = clientB }); session.Save(new Project { Name = "C", BillingClient = null, CorporateClient = corpA, Client = clientA }); session.Save(new Project { Name = "D", BillingClient = null, CorporateClient = corpB, Client = clientA }); session.Save(new Project { Name = "E", BillingClient = corpA, CorporateClient = null, Client = clientA }); session.Save(new Project { Name = "F", BillingClient = clientB, CorporateClient = null, Client = clientA }); session.Save(new Project { Name = "G", BillingClient = clientZ, CorporateClient = null, Client = clientA }); session.Save(new Project { Name = "Z", BillingClient = null, CorporateClient = null, Client = null }); session.Flush(); transaction.Commit(); } }
protected override void OnSetUp() { using (var session = OpenSession()) using (var transaction = session.BeginTransaction()) { var clientA = new Client { Name = "Albert" }; var clientB = new Client { Name = "Bob" }; var clientC = new CorporateClient { Name = "Charlie", CorporateId = "1234" }; session.Save(clientA); session.Save(clientB); session.Save(clientC); session.Save(new Project { Name = "A", EmailPref = EmailPref.Primary, Client = clientA, BillingClient = clientB, CorporateClient = clientC, }); session.Save(new Project { Name = "B", EmailPref = EmailPref.Billing, Client = clientA, BillingClient = clientB, CorporateClient = clientC, }); session.Save(new Project { Name = "C", EmailPref = EmailPref.Corp, Client = clientA, BillingClient = clientB, CorporateClient = clientC, }); session.Save(new Project { Name = "D", EmailPref = EmailPref.Primary, Client = null, BillingClient = clientB, CorporateClient = clientC, }); session.Save(new Project { Name = "E", EmailPref = EmailPref.Billing, Client = clientA, BillingClient = null, CorporateClient = clientC, }); session.Save(new Project { Name = "F", EmailPref = EmailPref.Corp, Client = clientA, BillingClient = clientB, CorporateClient = null, }); session.Flush(); transaction.Commit(); } }
protected override void OnSetUp() { using (var session = OpenSession()) using (var transaction = session.BeginTransaction()) { var clientA = new Client { Name = "Albert" }; var clientB = new Client { Name = "Bob" }; var corpA = new CorporateClient { Name = "Alpha", CorporateId = "1234" }; var corpB = new CorporateClient { Name = "Beta", CorporateId = "5647" }; var clientZ = new Client { Name = null }; // A null value should propagate if the entity is non-null session.Save(clientA); session.Save(clientB); session.Save(corpA); session.Save(corpB); session.Save(clientZ); var projectA = new Project { Name = "A", BillingClient = null, Client = clientA }; var projectB = new Project { Name = "B", BillingClient = corpB, Client = clientA }; var projectC = new Project { Name = "C", BillingClient = null, Client = clientB }; var projectD = new Project { Name = "D", BillingClient = corpA, Client = clientB }; var projectE = new Project { Name = "E", BillingClient = clientZ, Client = clientA }; var projectZ = new Project { Name = "Z", BillingClient = null, Client = null }; session.Save(projectA); session.Save(projectB); session.Save(projectC); session.Save(projectD); session.Save(projectE); session.Save(projectZ); session.Save(new Issue { Name = "01", Project = null, Client = null }); session.Save(new Issue { Name = "02", Project = null, Client = clientA }); session.Save(new Issue { Name = "03", Project = null, Client = clientB }); session.Save(new Issue { Name = "04", Project = projectC, Client = clientA }); session.Save(new Issue { Name = "05", Project = projectA, Client = clientB }); session.Save(new Issue { Name = "06", Project = projectB, Client = clientA }); session.Save(new Issue { Name = "07", Project = projectD, Client = clientB }); session.Save(new Issue { Name = "08", Project = projectZ, Client = corpA }); session.Save(new Issue { Name = "09", Project = projectZ, Client = corpB }); session.Save(new Issue { Name = "10", Project = projectE, Client = clientA }); session.Flush(); transaction.Commit(); } }