public void Edit()
        {
            var organisations = new Organisations(this.Session).Extent();
            var organisation  = organisations.First(v => v.PartyName.Equals("Acme0"));
            var contact       = organisation.CurrentContacts.First;

            var allors         = new Organisations(this.Session).FindBy(M.Organisation.Name, "Allors BVBA");
            var firstEmployee  = allors.ActiveEmployees.First(v => v.FirstName.Equals("first"));
            var secondEmployee = allors.ActiveEmployees.First(v => v.FirstName.Equals("second"));

            var editCommunicationEvent = new FaceToFaceCommunicationBuilder(this.Session)
                                         .WithSubject("dummy")
                                         .WithFromParty(organisation.CurrentContacts.First)
                                         .WithToParty(firstEmployee)
                                         .WithLocation("old location")
                                         .Build();

            this.Session.Derive();
            this.Session.Commit();

            var before = new FaceToFaceCommunications(this.Session).Extent().ToArray();

            var page = this.organisationListPage.Select(organisation).SelectFaceToFaceCommunication(editCommunicationEvent);

            page.EventState.Set(new CommunicationEventStates(this.Session).Completed.Name)
            .Purposes.Toggle(new CommunicationEventPurposes(this.Session).Conference.Name)
            .Location.Set("new location")
            .Subject.Set("new subject")
            .FromParty.Set(secondEmployee.PartyName)
            .ToParty.Set(contact.PartyName)
            .ScheduledStart.Set(DateTimeFactory.CreateDate(2018, 12, 24))
            .ScheduledEnd.Set(DateTimeFactory.CreateDate(2018, 12, 24))
            .ActualStart.Set(DateTimeFactory.CreateDate(2018, 12, 24))
            .ActualEnd.Set(DateTimeFactory.CreateDate(2018, 12, 24))
            .Save.Click();

            this.Driver.WaitForAngular();
            this.Session.Rollback();

            var after = new FaceToFaceCommunications(this.Session).Extent().ToArray();

            Assert.Equal(after.Length, before.Length);

            Assert.Equal(new CommunicationEventStates(this.Session).Completed, editCommunicationEvent.CommunicationEventState);
            Assert.Contains(new CommunicationEventPurposes(this.Session).Conference, editCommunicationEvent.EventPurposes);
            Assert.Equal(secondEmployee, editCommunicationEvent.FromParty);
            Assert.Equal(contact, editCommunicationEvent.ToParty);
            Assert.Equal("new location", editCommunicationEvent.Location);
            Assert.Equal("new subject", editCommunicationEvent.Subject);
            //Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 24).Date, communicationEvent.ScheduledStart);
            //Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 24).Date, communicationEvent.ScheduledEnd.Value.Date);
            //Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 24).Date, communicationEvent.ActualStart.Value.Date);
            //Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 24).Date, communicationEvent.ActualEnd.Value.Date);
        }
        public void Create()
        {
            var allors   = new Organisations(this.Session).FindBy(M.Organisation.Name, "Allors BVBA");
            var employee = allors.ActiveEmployees.First;

            var before = new FaceToFaceCommunications(this.Session).Extent().ToArray();

            var organisation = allors.ActiveCustomers.First(v => v.GetType().Name == typeof(Organisation).Name);
            var contact      = organisation.CurrentContacts.First;

            this.organisationListPage.Table.DefaultAction(organisation);
            var faceToFaceCommunicationEdit = new OrganisationOverviewComponent(this.organisationListPage.Driver).CommunicationeventOverviewPanel.Click().CreateFaceToFaceCommunication();

            faceToFaceCommunicationEdit
            .CommunicationEventState.Select(new CommunicationEventStates(this.Session).Completed)
            .EventPurposes.Toggle(new CommunicationEventPurposes(this.Session).Appointment)
            .Location.Set("location")
            .Subject.Set("subject")
            .FromParty.Select(employee)
            .ToParty.Select(contact)
            .ScheduledStart.Set(DateTimeFactory.CreateDate(2018, 12, 22))
            .ScheduledEnd.Set(DateTimeFactory.CreateDate(2018, 12, 22))
            .ActualStart.Set(DateTimeFactory.CreateDate(2018, 12, 23))
            .ActualEnd.Set(DateTimeFactory.CreateDate(2018, 12, 23))
            .SAVE.Click();

            this.Driver.WaitForAngular();
            this.Session.Rollback();

            var after = new FaceToFaceCommunications(this.Session).Extent().ToArray();

            Assert.Equal(after.Length, before.Length + 1);

            var communicationEvent = after.Except(before).First();

            Assert.Equal(new CommunicationEventStates(this.Session).Completed, communicationEvent.CommunicationEventState);
            Assert.Contains(new CommunicationEventPurposes(this.Session).Appointment, communicationEvent.EventPurposes);
            Assert.Equal(employee, communicationEvent.FromParty);
            Assert.Equal(contact, communicationEvent.ToParty);
            Assert.Equal("location", communicationEvent.Location);
            Assert.Equal("subject", communicationEvent.Subject);
            // Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 22).Date, communicationEvent.ScheduledStart.Value.ToUniversalTime().Date);
            // Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 22).Date, communicationEvent.ScheduledEnd.Value.Date.ToUniversalTime().Date);
            // Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 23).Date, communicationEvent.ActualStart.Value.Date.ToUniversalTime().Date);
            // Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 23).Date, communicationEvent.ActualEnd.Value.Date.ToUniversalTime().Date);
        }
        public void Create()
        {
            var allors   = new Organisations(this.Session).FindBy(M.Organisation.Name, "Allors BVBA");
            var employee = allors.ActiveEmployees.First;

            var before = new FaceToFaceCommunications(this.Session).Extent().ToArray();

            var extent       = new Organisations(this.Session).Extent();
            var organisation = extent.First(v => v.PartyName.Equals("Acme0"));
            var contact      = organisation.CurrentContacts.First;

            var personOverview = this.organisationListPage.Select(organisation);
            var page           = personOverview.NewFaceToFaceCommunication();

            page.EventState.Set(new CommunicationEventStates(this.Session).Completed.Name)
            .Purposes.Toggle(new CommunicationEventPurposes(this.Session).Appointment.Name)
            .Location.Set("location")
            .Subject.Set("subject")
            .FromParty.Set(employee.PartyName)
            .ToParty.Set(contact.PartyName)
            .ScheduledStart.Set(DateTimeFactory.CreateDate(2018, 12, 22))
            .ScheduledEnd.Set(DateTimeFactory.CreateDate(2018, 12, 22))
            .ActualStart.Set(DateTimeFactory.CreateDate(2018, 12, 23))
            .ActualEnd.Set(DateTimeFactory.CreateDate(2018, 12, 23))
            .Save.Click();

            this.Driver.WaitForAngular();
            this.Session.Rollback();

            var after = new FaceToFaceCommunications(this.Session).Extent().ToArray();

            Assert.Equal(after.Length, before.Length + 1);

            var communicationEvent = after.Except(before).First();

            Assert.Equal(new CommunicationEventStates(this.Session).Completed, communicationEvent.CommunicationEventState);
            Assert.Contains(new CommunicationEventPurposes(this.Session).Appointment, communicationEvent.EventPurposes);
            Assert.Equal(employee, communicationEvent.FromParty);
            Assert.Equal(contact, communicationEvent.ToParty);
            Assert.Equal("location", communicationEvent.Location);
            Assert.Equal("subject", communicationEvent.Subject);
            //Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 22).Date, communicationEvent.ScheduledStart.Value.ToUniversalTime().Date);
            //Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 22).Date, communicationEvent.ScheduledEnd.Value.Date.ToUniversalTime().Date);
            //Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 23).Date, communicationEvent.ActualStart.Value.Date.ToUniversalTime().Date);
            //Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 23).Date, communicationEvent.ActualEnd.Value.Date.ToUniversalTime().Date);
        }
        public void Edit()
        {
            var allors        = new Organisations(this.Session).FindBy(M.Organisation.Name, "Allors BVBA");
            var firstEmployee = allors.ActiveEmployees.First();

            var secondEmployee = allors.CreateEmployee("letmein", this.Session.Faker()); //second employee

            this.Session.Derive();

            var organisation = allors.ActiveCustomers.First(v => v.GetType().Name == typeof(Organisation).Name);
            var contact      = organisation.CurrentContacts.First;

            var editCommunicationEvent = new FaceToFaceCommunicationBuilder(this.Session)
                                         .WithSubject("dummy")
                                         .WithFromParty(organisation.CurrentContacts.First)
                                         .WithToParty(firstEmployee)
                                         .WithLocation("old location")
                                         .Build();

            this.Session.Derive();
            this.Session.Commit();

            var before = new FaceToFaceCommunications(this.Session).Extent().ToArray();

            this.organisationListPage.Table.DefaultAction(organisation);
            var organisationOverview = new OrganisationOverviewComponent(this.organisationListPage.Driver);

            var communicationEventOverview = organisationOverview.CommunicationeventOverviewPanel.Click();

            communicationEventOverview.Table.DefaultAction(editCommunicationEvent);

            var faceToFaceCommunicationEdit = new FaceToFaceCommunicationEditComponent(organisationOverview.Driver);

            faceToFaceCommunicationEdit
            .CommunicationEventState.Select(new CommunicationEventStates(this.Session).Completed)
            .EventPurposes.Toggle(new CommunicationEventPurposes(this.Session).Conference)
            .Location.Set("new location")
            .Subject.Set("new subject")
            .FromParty.Select(secondEmployee)
            .ToParty.Select(contact)
            .ScheduledStart.Set(DateTimeFactory.CreateDate(2018, 12, 24))
            .ScheduledEnd.Set(DateTimeFactory.CreateDate(2018, 12, 24))
            .ActualStart.Set(DateTimeFactory.CreateDate(2018, 12, 24))
            .ActualEnd.Set(DateTimeFactory.CreateDate(2018, 12, 24))
            .SAVE.Click();

            this.Driver.WaitForAngular();
            this.Session.Rollback();

            var after = new FaceToFaceCommunications(this.Session).Extent().ToArray();

            Assert.Equal(after.Length, before.Length);

            Assert.Equal(new CommunicationEventStates(this.Session).Completed, editCommunicationEvent.CommunicationEventState);
            Assert.Contains(new CommunicationEventPurposes(this.Session).Conference, editCommunicationEvent.EventPurposes);
            Assert.Equal(secondEmployee, editCommunicationEvent.FromParty);
            Assert.Equal(contact, editCommunicationEvent.ToParty);
            Assert.Equal("new location", editCommunicationEvent.Location);
            Assert.Equal("new subject", editCommunicationEvent.Subject);
            Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 24).Date, editCommunicationEvent.ScheduledStart);
            Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 24).Date, editCommunicationEvent.ScheduledEnd.Value.Date);
            Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 24).Date, editCommunicationEvent.ActualStart.Value.Date);
            Assert.Equal(DateTimeFactory.CreateDate(2018, 12, 24).Date, editCommunicationEvent.ActualEnd.Value.Date);
        }
        public void Edit()
        {
            var faker    = this.Session.Faker();
            var subject  = faker.Lorem.Sentence();
            var location = faker.Address.FullAddress();

            var person = new People(this.Session).Extent().First;

            var allors         = new Organisations(this.Session).FindBy(M.Organisation.Name, "Allors BVBA");
            var firstEmployee  = allors.ActiveEmployees.First();
            var secondEmployee = allors.ActiveEmployees.Last();

            var editCommunicationEvent = new FaceToFaceCommunicationBuilder(this.Session)
                                         .WithSubject(subject)
                                         .WithFromParty(person)
                                         .WithToParty(firstEmployee)
                                         .WithLocation(location)
                                         .Build();

            this.Session.Derive();
            this.Session.Commit();

            var before = new FaceToFaceCommunications(this.Session).Extent().ToArray();

            this.personListPage.Table.DefaultAction(person);
            var personOverview = new PersonOverviewComponent(this.personListPage.Driver);

            var communicationEventOverview = personOverview.CommunicationeventOverviewPanel.Click();

            communicationEventOverview.Table.DefaultAction(editCommunicationEvent);

            var faceToFaceCommunicationEditComponent = new FaceToFaceCommunicationEditComponent(this.Driver);

            var scheduleStartDate = DateTimeFactory.CreateDate(2018, 12, 24);
            var scheduleEndDate   = DateTimeFactory.CreateDate(2018, 12, 24);
            var actualStartDate   = DateTimeFactory.CreateDate(2018, 12, 24);
            var actualEndDate     = DateTimeFactory.CreateDate(2018, 12, 24);

            faceToFaceCommunicationEditComponent
            .CommunicationEventState.Select(new CommunicationEventStates(this.Session).Completed)
            .EventPurposes.Toggle(new CommunicationEventPurposes(this.Session).Conference)
            .Subject.Set(subject)
            .Location.Set(location)
            .FromParty.Select(secondEmployee)
            .ToParty.Select(person)
            .ScheduledStart.Set(scheduleStartDate)
            .ScheduledEnd.Set(scheduleEndDate)
            .ActualStart.Set(actualStartDate)
            .ActualEnd.Set(actualEndDate)
            .SAVE.Click();

            this.Driver.WaitForAngular();
            this.Session.Rollback();

            var after = new FaceToFaceCommunications(this.Session).Extent().ToArray();

            Assert.Equal(after.Length, before.Length);

            Assert.Equal(new CommunicationEventStates(this.Session).Completed, editCommunicationEvent.CommunicationEventState);
            Assert.Contains(new CommunicationEventPurposes(this.Session).Conference, editCommunicationEvent.EventPurposes);
            Assert.Equal(secondEmployee, editCommunicationEvent.FromParty);
            Assert.Equal(person, editCommunicationEvent.ToParty);
            Assert.Equal(subject, editCommunicationEvent.Subject);
            Assert.Equal(location, editCommunicationEvent.Location);
            Assert.Equal(scheduleStartDate.Date, editCommunicationEvent.ScheduledStart.Value.Date);
            Assert.Equal(scheduleEndDate.Date, editCommunicationEvent.ScheduledEnd.Value.Date);
            Assert.Equal(actualStartDate.Date, editCommunicationEvent.ActualStart.Value.Date);
            Assert.Equal(actualEndDate.Date, editCommunicationEvent.ActualEnd.Value.Date);
        }