private void InstantiateObjects(ISession session)
 {
     this.contact                         = (Person)session.Instantiate(this.contact);
     this.supplier                        = (Organisation)session.Instantiate(this.supplier);
     this.supplierRelationship            = (SupplierRelationship)session.Instantiate(this.supplierRelationship);
     this.organisationContactRelationship = (OrganisationContactRelationship)session.Instantiate(this.organisationContactRelationship);
 }
        public SupplierRelationshipTests()
        {
            this.contact  = new PersonBuilder(this.Session).WithLastName("contact").Build();
            this.supplier = new OrganisationBuilder(this.Session)
                            .WithName("supplier")
                            .WithLocale(new Locales(this.Session).EnglishGreatBritain)

                            .Build();

            this.organisationContactRelationship = new OrganisationContactRelationshipBuilder(this.Session)
                                                   .WithOrganisation(this.supplier)
                                                   .WithContact(this.contact)
                                                   .WithFromDate(DateTime.UtcNow)
                                                   .Build();

            this.supplierRelationship = new SupplierRelationshipBuilder(this.Session)
                                        .WithSupplier(this.supplier)
                                        .WithFromDate(DateTime.UtcNow.AddYears(-1))
                                        .Build();

            this.Session.Derive();
            this.Session.Commit();
        }
 private void InstantiateObjects(ISession session)
 {
     this.contact = (Person)session.Instantiate(this.contact);
     this.supplier = (Organisation)session.Instantiate(this.supplier);
     this.internalOrganisation = (InternalOrganisation)session.Instantiate(this.internalOrganisation);
     this.supplierRelationship = (SupplierRelationship)session.Instantiate(this.supplierRelationship);
 }
        public override void Init()
        {
            base.Init();

            this.contact = new PersonBuilder(this.DatabaseSession).WithLastName("contact").Build();
            this.supplier = new OrganisationBuilder(this.DatabaseSession)
                .WithName("supplier")
                .WithLocale(new Locales(this.DatabaseSession).EnglishGreatBritain)
                .Build();
            this.internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");

            new OrganisationContactRelationshipBuilder(this.DatabaseSession)
                .WithOrganisation(this.supplier)
                .WithContact(this.contact)
                .WithFromDate(DateTime.UtcNow)
                .Build();

            this.supplierRelationship = new SupplierRelationshipBuilder(this.DatabaseSession)
                .WithSupplier(this.supplier)
                .WithInternalOrganisation(this.internalOrganisation)
                .WithFromDate(DateTime.UtcNow)
                .Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();
        }