public void Edit() { var before = new Employments(this.Session).Extent().ToArray(); var employer = new Organisations(this.Session).FindBy(M.Organisation.Name, "Allors BVBA"); this.people.Table.DefaultAction(this.employee); var personOverviewPage = new PersonOverviewComponent(this.people.Driver); var partyRelationshipOverview = personOverviewPage.PartyrelationshipOverviewPanel.Click(); partyRelationshipOverview.Table.DefaultAction(this.editPartyRelationship); var employmentEditComponent = new EmploymentEditComponent(this.Driver); employmentEditComponent.FromDate.Set(DateTimeFactory.CreateDate(2018, 12, 22)) .ThroughDate.Set(DateTimeFactory.CreateDate(2018, 12, 22).AddYears(1)) .SAVE.Click(); this.Driver.WaitForAngular(); this.Session.Rollback(); var after = new Employments(this.Session).Extent().ToArray(); Assert.Equal(after.Length, before.Length); Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 22).Date, this.editPartyRelationship.FromDate.Date.ToUniversalTime().Date); Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 22).AddYears(1).Date, this.editPartyRelationship.ThroughDate.Value.Date.ToUniversalTime().Date); Assert.Equal(employer, this.editPartyRelationship.Employer); Assert.Equal(this.employee, this.editPartyRelationship.Employee); }
public void Edit() { var employer = new Organisations(this.Session).FindBy(M.Organisation.Name, "Allors BVBA"); var employee = new PersonBuilder(this.Session).WithLastName("employee").Build(); // Delete all existing for the new one to be in the first page of the list. foreach (PartyRelationship partyRelationship in employer.PartyRelationshipsWhereParty) { partyRelationship.Delete(); } this.Session.Derive(); this.Session.Commit(); var editPartyRelationship = new EmploymentBuilder(this.Session) .WithEmployee(employee) .WithEmployer(employer) .Build(); this.Session.Derive(); this.Session.Commit(); var before = new Employments(this.Session).Extent().ToArray(); this.organisationListPage.Table.DefaultAction(employer); var organisationOverview = new OrganisationOverviewComponent(this.organisationListPage.Driver); var partyRelationshipOverview = organisationOverview.PartyrelationshipOverviewPanel.Click(); partyRelationshipOverview.Table.DefaultAction(editPartyRelationship); var partyRelationshipEdit = new EmploymentEditComponent(organisationOverview.Driver); partyRelationshipEdit .FromDate.Set(DateTimeFactory.CreateDate(2018, 12, 22)) .ThroughDate.Set(DateTimeFactory.CreateDate(2018, 12, 22).AddYears(1)) .SAVE.Click(); this.Driver.WaitForAngular(); this.Session.Rollback(); var after = new Employments(this.Session).Extent().ToArray(); Assert.Equal(after.Length, before.Length); // Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 22).Date, this.editPartyRelationship.FromDate.Date.ToUniversalTime().Date); // Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 22).AddYears(1).Date, this.editPartyRelationship.ThroughDate.Value.Date.ToUniversalTime().Date); Assert.Equal(employer, editPartyRelationship.Employer); Assert.Equal(employee, editPartyRelationship.Employee); }