public void Create()
        {
            var allors   = new Organisations(this.Session).FindBy(M.Organisation.Name, "Allors BVBA");
            var employee = allors.ActiveEmployees.First();

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

            var employeeEmailAddress = employee.PersonalEmailAddress;
            var personEmailAddress   = organisation.CurrentContacts.First.PersonalEmailAddress;

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

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

            this.organisationListPage.Table.DefaultAction(organisation);
            var organisationOverview       = new OrganisationOverviewComponent(this.organisationListPage.Driver);
            var communicationEventOverview = organisationOverview.CommunicationeventOverviewPanel.Click();
            var emailCommunicationEdit     = communicationEventOverview.CreateEmailCommunication();

            emailCommunicationEdit
            .CommunicationEventState.Select(new CommunicationEventStates(this.Session).Completed)
            .EventPurposes.Toggle(new CommunicationEventPurposes(this.Session).Appointment)
            .FromParty.Select(employee)
            .FromEmail.Select(employeeEmailAddress)
            .ToParty.Select(contact)
            .ToEmail.Select(personEmailAddress)
            .SubjectTemplate.Set("subject")
            .BodyTemplate.Set("body")
            .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 EmailCommunications(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(employeeEmailAddress, communicationEvent.FromEmail);
            Assert.Equal(contact, communicationEvent.ToParty);
            Assert.Equal(personEmailAddress, communicationEvent.ToEmail);
            Assert.Equal("subject", communicationEvent.EmailTemplate.SubjectTemplate);
            Assert.Equal("body", communicationEvent.EmailTemplate.BodyTemplate);
            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);
        }
Esempio n. 2
0
        public void Create()
        {
            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 employee = allors.ActiveEmployees.First(v => v.FirstName.Equals("first"));

            var employeeEmailAddress = employee.PersonalEmailAddress;
            var personEmailAddress   = organisation.CurrentContacts.First.PersonalEmailAddress;

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

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

            var organisationOverviewPage = this.organisationListPage.Select(organisation);
            var page = organisationOverviewPage.NewEmailCommunication();

            page.EventState.Set(new CommunicationEventStates(this.Session).Completed.Name)
            .Purposes.Toggle(new CommunicationEventPurposes(this.Session).Appointment.Name)
            .FromParty.Set(employee.PartyName)
            .FromEmail.Set(employeeEmailAddress.ElectronicAddressString)
            .ToParty.Set(contact.PartyName)
            .ToEmail.Set(personEmailAddress.ElectronicAddressString)
            .Subject.Set("subject")
            .Body.Set("body")
            .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 EmailCommunications(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(employeeEmailAddress, communicationEvent.FromEmail);
            Assert.Equal(contact, communicationEvent.ToParty);
            Assert.Equal(personEmailAddress, communicationEvent.ToEmail);
            Assert.Equal("subject", communicationEvent.EmailTemplate.SubjectTemplate);
            Assert.Equal("body", communicationEvent.EmailTemplate.BodyTemplate);
            //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 person = new People(this.Session).Extent().First;

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

            var employeeEmailAddress = employee.PersonalEmailAddress;
            var personEmailAddress   = person.PersonalEmailAddress;

            var editCommunicationEvent = new EmailCommunicationBuilder(this.Session)
                                         .WithSubject("dummy")
                                         .WithFromEmail(employeeEmailAddress)
                                         .WithFromParty(employee)
                                         .WithToParty(person)
                                         .WithToEmail(personEmailAddress)
                                         .WithEmailTemplate(new EmailTemplateBuilder(this.Session).Build())
                                         .Build();

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

            var before = new EmailCommunications(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 emailCommunicationEdit = new EmailCommunicationEditComponent(this.Driver);

            emailCommunicationEdit
            .CommunicationEventState.Select(new CommunicationEventStates(this.Session).Completed)
            .EventPurposes.Toggle(new CommunicationEventPurposes(this.Session).Inquiry)
            .FromParty.Select(person)
            .FromEmail.Select(personEmailAddress)
            .ToParty.Select(employee)
            .ToEmail.Select(employeeEmailAddress)
            .SubjectTemplate.Set("new subject")
            .BodyTemplate.Set("new body")
            .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 EmailCommunications(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).Inquiry, editCommunicationEvent.EventPurposes);
            Assert.Equal(person, editCommunicationEvent.FromParty);
            Assert.Equal(personEmailAddress, editCommunicationEvent.FromEmail);
            Assert.Equal(employee, editCommunicationEvent.ToParty);
            Assert.Equal(employeeEmailAddress, editCommunicationEvent.ToEmail);
            Assert.Equal("new subject", editCommunicationEvent.EmailTemplate.SubjectTemplate);
            Assert.Equal("new body", editCommunicationEvent.EmailTemplate.BodyTemplate);
            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 people = new People(this.Session).Extent();
            var person = people.First(v => v.PartyName.Equals("John0 Doe0"));

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

            var employeeEmailAddress = employee.PersonalEmailAddress;
            var personEmailAddress   = person.PersonalEmailAddress;

            var editCommunicationEvent = new EmailCommunicationBuilder(this.Session)
                                         .WithSubject("dummy")
                                         .WithFromEmail(employeeEmailAddress)
                                         .WithToEmail(personEmailAddress)
                                         .WithEmailTemplate(new EmailTemplateBuilder(this.Session).Build())
                                         .Build();

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

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

            var personOverview = this.personListPage.Select(person);

            var page = personOverview.SelectEmailCommunication(editCommunicationEvent);

            page.EventState.Set(new CommunicationEventStates(this.Session).Completed.Name)
            .Purposes.Toggle(new CommunicationEventPurposes(this.Session).Inquiry.Name)
            .FromParty.Set(person.PartyName)
            .FromEmail.Set(personEmailAddress.ElectronicAddressString)
            .ToParty.Set(employee.PartyName)
            .ToEmail.Set(employeeEmailAddress.ElectronicAddressString)
            .Subject.Set("new subject")
            .Body.Set("new body")
            .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 EmailCommunications(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).Inquiry, editCommunicationEvent.EventPurposes);
            Assert.Equal(person, editCommunicationEvent.FromParty);
            Assert.Equal(personEmailAddress, editCommunicationEvent.FromEmail);
            Assert.Equal(employee, editCommunicationEvent.ToParty);
            Assert.Equal(employeeEmailAddress, editCommunicationEvent.ToEmail);
            Assert.Equal("new subject", editCommunicationEvent.EmailTemplate.SubjectTemplate);
            Assert.Equal("new body", editCommunicationEvent.EmailTemplate.BodyTemplate);
            //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);
        }
Esempio n. 5
0
        // Instantiate and fill in values of variables/properties in class
        private void instantiateDataMembers()
        {
            externalIP = new WebsiteCommunications();
            email = new EmailCommunications();
            filterIP = new FilterIPAddress();
            databaseCommunications = new DatabaseCommunication();
            _ThreadException = null;

            // Load Last IP
            lastIP = getLastIPDataSet();
        }