Ejemplo n.º 1
0
        public void Create()
        {
            var before = new EmailAddresses(this.Session).Extent().ToArray();

            var extent = new People(this.Session).Extent();
            var person = extent.First(v => v.PartyName.Equals("John0 Doe0"));

            var page = this.personListPage.Select(person).NewEmailAddress();

            page.ContactPurposes.Toggle(new ContactMechanismPurposes(this.Session).BillingAddress.Name)
            .ElectronicAddressString.Set("*****@*****.**")
            .Description.Set("description")
            .Save.Click();

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

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

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

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

            Assert.Equal("*****@*****.**", contactMechanism.ElectronicAddressString);
            Assert.Equal("description", contactMechanism.Description);
        }
Ejemplo n.º 2
0
        private void FillGrid()
        {
            EmailAddresses.RefreshCache();
            _listEmailAddresses = EmailAddresses.GetDeepCopy();
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col;

            col = new ODGridColumn(Lan.g(this, "User Name"), 240);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Sender Address"), 270);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Default"), 50, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Notify"), 0, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < _listEmailAddresses.Count; i++)
            {
                row = new ODGridRow();
                row.Cells.Add(_listEmailAddresses[i].EmailUsername);
                row.Cells.Add(_listEmailAddresses[i].SenderAddress);
                row.Cells.Add((_listEmailAddresses[i].EmailAddressNum == PrefC.GetLong(PrefName.EmailDefaultAddressNum))?"X":"");
                row.Cells.Add((_listEmailAddresses[i].EmailAddressNum == PrefC.GetLong(PrefName.EmailNotifyAddressNum))?"X":"");
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Ejemplo n.º 3
0
        public void Create()
        {
            var before = new EmailAddresses(this.Session).Extent().ToArray();

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

            this.personListPage.Table.DefaultAction(person);
            var emailAddressCreate = new PersonOverviewComponent(this.personListPage.Driver).ContactmechanismOverviewPanel.Click().CreateEmailAddress();

            emailAddressCreate
            .ContactPurposes.Toggle(new ContactMechanismPurposes(this.Session).GeneralPhoneNumber)
            .ElectronicAddressString.Set("*****@*****.**")
            .Description.Set("description")
            .SAVE.Click();

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

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

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

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

            Assert.Equal("*****@*****.**", contactMechanism.ElectronicAddressString);
            Assert.Equal("description", contactMechanism.Description);
        }
Ejemplo n.º 4
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     EmailAddressCur.SMTPserver    = PIn.String(textSMTPserver.Text);
     EmailAddressCur.EmailUsername = PIn.String(textUsername.Text);
     EmailAddressCur.EmailPassword = PIn.String(textPassword.Text);
     try{
         EmailAddressCur.ServerPort = PIn.Int(textPort.Text);
     }
     catch {
         MsgBox.Show(this, "invalid outgoing port number.");
     }
     EmailAddressCur.UseSSL             = checkSSL.Checked;
     EmailAddressCur.SenderAddress      = PIn.String(textSender.Text);
     EmailAddressCur.Pop3ServerIncoming = PIn.String(textSMTPserverIncoming.Text);
     try {
         EmailAddressCur.ServerPortIncoming = PIn.Int(textPortIncoming.Text);
     }
     catch {
         MsgBox.Show(this, "invalid incoming port number.");
     }
     if (IsNew)
     {
         EmailAddresses.Insert(EmailAddressCur);
     }
     else
     {
         EmailAddresses.Update(EmailAddressCur);
     }
     DialogResult = DialogResult.OK;
 }
Ejemplo n.º 5
0
        public void Edit()
        {
            var extent = new People(this.Session).Extent();
            var person = extent.First(v => v.PartyName.Equals("John0 Doe0"));

            var electronicAddress = new EmailAddressBuilder(this.Session)
                                    .WithElectronicAddressString("*****@*****.**")
                                    .Build();

            var partyContactMechanism = new PartyContactMechanismBuilder(this.Session).WithContactMechanism(electronicAddress).Build();

            person.AddPartyContactMechanism(partyContactMechanism);

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

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

            var page = this.personListPage.Select(person).SelectElectronicAddress(electronicAddress);

            page.ElectronicAddressString.Set("*****@*****.**")
            .Description.Set("description")
            .Save.Click();

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

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

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

            Assert.Equal("*****@*****.**", electronicAddress.ElectronicAddressString);
            Assert.Equal("description", electronicAddress.Description);
        }
Ejemplo n.º 6
0
        private void butDelete_Click(object sender, EventArgs e)
        {
            if (IsNew)
            {
                DialogResult = DialogResult.Cancel;
                return;
            }
            if (EmailAddressCur.EmailAddressNum == PrefC.GetLong(PrefName.EmailDefaultAddressNum))
            {
                MsgBox.Show(this, "Cannot delete the default email address.");
                return;
            }
            if (EmailAddressCur.EmailAddressNum == PrefC.GetLong(PrefName.EmailNotifyAddressNum))
            {
                MsgBox.Show(this, "Cannot delete the notify email address.");
                return;
            }
            Clinic clinic = Clinics.GetFirstOrDefault(x => x.EmailAddressNum == EmailAddressCur.EmailAddressNum);

            if (clinic != null)
            {
                MessageBox.Show(Lan.g(this, "Cannot delete the email address because it is used by clinic") + " " + clinic.Description);
                return;
            }
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete this email address?"))
            {
                return;
            }
            EmailAddresses.Delete(EmailAddressCur.EmailAddressNum);
            DialogResult = DialogResult.OK;          //OK triggers a refresh for the grid.
        }
Ejemplo n.º 7
0
        private void FillComboEmail()
        {
            _listEmailAddresses = EmailAddresses.GetDeepCopy();          //Does not include user specific email addresses.
            List <Clinic> listClinicsAll = Clinics.GetDeepCopy();

            _listEmailAddresses.RemoveAll(x => listClinicsAll.Any(y => x.EmailAddressNum == y.EmailAddressNum));          //Exclude any email addresses that are associated to a clinic.
            //Exclude default practice email address.
            _listEmailAddresses.RemoveAll(x => x.EmailAddressNum == PrefC.GetLong(PrefName.EmailDefaultAddressNum));
            //Exclude web mail notification email address.
            _listEmailAddresses.RemoveAll(x => x.EmailAddressNum == PrefC.GetLong(PrefName.EmailNotifyAddressNum));
            comboEmailFrom.Items.Add(Lan.g(this, "Practice/Clinic"));           //default
            comboEmailFrom.SelectedIndex = 0;
            textFromAddress.Text         = EmailAddresses.GetByClinic(Clinics.ClinicNum).EmailUsername;
            //Add all email addresses which are not associated to a user, a clinic, or either of the default email addresses.
            for (int i = 0; i < _listEmailAddresses.Count; i++)
            {
                comboEmailFrom.Items.Add(_listEmailAddresses[i].EmailUsername);
            }
            //Add user specific email address if present.
            EmailAddress emailAddressMe = EmailAddresses.GetForUser(Security.CurUser.UserNum);            //can be null

            if (emailAddressMe != null)
            {
                _listEmailAddresses.Insert(0, emailAddressMe);
                comboEmailFrom.Items.Insert(1, Lan.g(this, "Me") + " <" + emailAddressMe.EmailUsername + ">");        //Just below Practice/Clinic
                comboEmailFrom.SelectedIndex = 1;
                textFromAddress.Text         = emailAddressMe.EmailUsername;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Returns true if CommonPersonDetail instances are equal
        /// </summary>
        /// <param name="other">Instance of CommonPersonDetail to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(CommonPersonDetail other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     PhoneNumbers == other.PhoneNumbers ||
                     PhoneNumbers != null &&
                     PhoneNumbers.SequenceEqual(other.PhoneNumbers)
                     ) &&
                 (
                     EmailAddresses == other.EmailAddresses ||
                     EmailAddresses != null &&
                     EmailAddresses.SequenceEqual(other.EmailAddresses)
                 ) &&
                 (
                     PhysicalAddresses == other.PhysicalAddresses ||
                     PhysicalAddresses != null &&
                     PhysicalAddresses.SequenceEqual(other.PhysicalAddresses)
                 ));
        }
Ejemplo n.º 9
0
 public override IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
 {
     if (DateOfBirth < DateTime.Now.AddYears(-Constants.MaxAgeInsuree) || DateOfBirth > DateTime.Now)
     {
         yield return
             (new ValidationResult(
                  $"Invalid range for date of birth; must be between {0} and {Constants.MaxAgeInsuree} years.",
                  new[] { "DateOfBirth" }));
     }
     foreach (var validationResult in Addresses.Validate())
     {
         yield return(validationResult);
     }
     foreach (var validationResult in EmailAddresses.Validate())
     {
         yield return(validationResult);
     }
     foreach (var validationResult in PhoneNumbers.Validate())
     {
         yield return(validationResult);
     }
     foreach (var validationResult in Insurances.Validate())
     {
         yield return(validationResult);
     }
 }
        /// <summary>
        /// Process Records
        /// </summary>
        protected override void ProcessRecord()
        {
            var qb = new QuerystringBuilder();

            if (Names != null && Names.Any())
            {
                qb.Add("usernames", string.Join(",", Names));
            }

            if (EmailAddresses != null && EmailAddresses.Any())
            {
                qb.Add("emailAddresses", string.Join(",", EmailAddresses));
            }

            if (!string.IsNullOrWhiteSpace(Domain))
            {
                qb.Add("domain", Domain);
            }

            var preparedUrl = $"/public/users{qb.Build()}";

            WriteDebug(preparedUrl);
            var result = Session.ApiClient.Get <IEnumerable <Models.User> >(preparedUrl);

            WriteObject(result, true);
        }
        public async Task <IActionResult> GetAdressLists(int zn)
        {
            Func <StandardMemberList, string[]> getAddresses = (sml) =>
            {
                var columns = sml.GetColumns().ToArray();
                return(GetMemberList(columns)
                       .Where(x => !string.IsNullOrWhiteSpace(x.Email) || !string.IsNullOrWhiteSpace(x.SecondEmail))
                       .SelectMany(x => x.GetEmailAddresses())
                       .ToArray());
            };

            using (new TimedAction(t => log.Debug($"get address lists for zone {zn} completed in {t.ToString("c")}")))
            {
                db.ChangeTracker.AutoDetectChangesEnabled = false;
                var zone = await db.Zones.Include(z => z.StreetRep)
                           .SingleAsync(x => x.Number == zn);

                var result = new EmailAddresses
                {
                    AddressesForMembers             = getAddresses(new ZoneMembers(zn)),
                    AddressesForMinutes             = getAddresses(new ZoneEmailMinutes(zn)),
                    AddressesForPaymentsOutstanding = getAddresses(new ZonePaymentsOutstanding(zn))
                };
                return(SuccessResult(result));
            }
        }
Ejemplo n.º 12
0
        protected override void deserialize(PowerPlannerSending.BaseItem item, List <PropertyNames> changedProperties)
        {
            Teacher from = item as Teacher;

            if (changedProperties != null)
            {
                if (!EmailAddresses.SequenceEqual(from.EmailAddresses))
                {
                    changedProperties.Add(BaseItemWin.PropertyNames.EmailAddresses);
                }

                if (!OfficeLocations.SequenceEqual(from.OfficeLocations))
                {
                    changedProperties.Add(BaseItemWin.PropertyNames.OfficeLocations);
                }

                if (!PhoneNumbers.SequenceEqual(from.PhoneNumbers))
                {
                    changedProperties.Add(BaseItemWin.PropertyNames.PhoneNumbers);
                }

                if (!PostalAddresses.SequenceEqual(from.PostalAddresses))
                {
                    changedProperties.Add(BaseItemWin.PropertyNames.PostalAddresses);
                }
            }

            this.EmailAddresses  = from.EmailAddresses;
            this.OfficeLocations = from.OfficeLocations;
            this.PhoneNumbers    = from.PhoneNumbers;
            this.PostalAddresses = from.PostalAddresses;

            //guaranteed that upper temp and perm will be -1
            base.deserialize(from, changedProperties);
        }
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            var correctiveAction = _correctiveActionRepository.GetOneByWorkflowId(context.Workflow.Id);

            correctiveAction.CorrectiveActionStateID     = _correctiveActionStateRepository.GetByCode(STATE_PLANNED_CODE);
            correctiveAction.MaxDateEfficiencyEvaluation = MaxDateEfficiencyEvaluation;
            correctiveAction.MaxDateImplementation       = MaxDateImplementation;
            correctiveAction.DeadlineDateEvaluation      = MaxDateEfficiencyEvaluation.AddDays(_parametrizationCorrectiveActionRepository.GetByCode(STATE_PARAMETRIZATION_CORRECTIVEACTION_CODE_EVALUATION));
            correctiveAction.Impact = Impact;

            _correctiveActionRepository.Update(correctiveAction);
            _correctiveActionStateHistoryRepository.Add(correctiveAction.CorrectiveActionID, correctiveAction.CorrectiveActionStateID, EmitterUserID);

            EmailAddresses.AddRange(_userWorkflowRepository.GetUsersEmailResponsibleSGC());
            EmailAddresses.Add(_userWorkflowRepository.GetUserEmailByID(correctiveAction.ResponsibleUserID));
            EmailAddresses.AddRange(_taskRepository.GetAllResponsibleUserEmailForCorrectiveAction(correctiveAction.CorrectiveActionID));
            EmailAddresses.AddRange(_sectorPlantRepository.GetSectorPlantReferredEmail(Convert.ToInt32(correctiveAction.PlantTreatmentID), Convert.ToInt32(correctiveAction.SectorTreatmentID)));

            correctiveAction = _correctiveActionRepository.GetOneByWorkflowId(correctiveAction.WorkflowId);
            var emailType = "generate";

            this.EmailSubject = EmailStrings.GetSubjectCorrectiveAction(emailType);
            this.EmailMessage = EmailStrings.GetMessageCorrectiveAction(correctiveAction, _emailSettings.Url, emailType);

            return(ExecutionResult.Next());
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Persons the email address duplication check dal.
 /// </summary>
 /// <param name="_objEmailAddresses">The object email addresses.</param>
 /// <param name="PersonId">The person identifier.</param>
 /// <returns>System.Int32.</returns>
 public int PersonEmailAddress_DuplicationCheckDAL(EmailAddresses _objEmailAddresses, long PersonId)
 {
     return(ExecuteScalarSPInt32("TMS_PersonEmailAddresses_DuplicationCheck",
                                 ParamBuilder.Par("Email", _objEmailAddresses.Email),
                                 ParamBuilder.Par("ID", _objEmailAddresses.ID),
                                 ParamBuilder.Par("PersonID", PersonId)));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the Person class.
 /// </summary>
 public Person()
 {
     EmailAddresses = new EmailAddresses();
     PhoneNumbers   = new PhoneNumbers();
     HomeAddress    = new Address(null, null, null, null, ContactType.Personal);
     WorkAddress    = new Address(null, null, null, null, ContactType.Business);
 }
Ejemplo n.º 16
0
        public override ExecutionResult Run(IStepExecutionContext context)
        {
            var correctiveAction = new CorrectiveActionWorkflowData();

            correctiveAction.WorkflowId                = context.Workflow.Id;
            correctiveAction.CreationDate              = CreationDate;
            correctiveAction.Description               = Description;
            correctiveAction.FindingID                 = FindingID;
            correctiveAction.EmitterUserID             = EmitterUserID;
            correctiveAction.PlantLocationID           = PlantLocationID;
            correctiveAction.SectorLocationID          = SectorLocationID;
            correctiveAction.PlantTreatmentID          = PlantTreatmentID;
            correctiveAction.SectorTreatmentID         = SectorTreatmentID;
            correctiveAction.ResponsibleUserID         = ResponsibleUserID;
            correctiveAction.ReviewerUserID            = ReviewerUserID;
            correctiveAction.DeadlineDatePlanification = CreationDate.AddDays(_parametrizationCorrectiveActionRepository.GetByCode(STATE_PARAMETRIZATION_CORRECTIVEACTION_CODE_PLANIFICATION));

            correctiveAction.CorrectiveActionStateID = _correctiveActionStateRepository.GetByCode(STATE_OPEN_CODE);
            CorrectiveActionWorkflowData correctiveActionWorkFlowData = _correctiveActionRepository.Add(correctiveAction);

            _correctiveActionStateHistoryRepository.Add(correctiveActionWorkFlowData.CorrectiveActionID, correctiveActionWorkFlowData.CorrectiveActionStateID, EmitterUserID);

            EmailAddresses.AddRange(_userWorkflowRepository.GetUsersEmailResponsibleSGC());
            EmailAddresses.Add(_userWorkflowRepository.GetUserEmailByID(ResponsibleUserID));
            EmailAddresses.Add(_userWorkflowRepository.GetUserEmailByID(ReviewerUserID));
            EmailAddresses.AddRange(_sectorPlantRepository.GetSectorPlantReferredEmail(Convert.ToInt32(correctiveAction.PlantTreatmentID), Convert.ToInt32(correctiveAction.SectorTreatmentID)));

            correctiveAction = _correctiveActionRepository.GetOneByWorkflowId(correctiveAction.WorkflowId);
            var emailType = "new";

            this.EmailSubject = EmailStrings.GetSubjectCorrectiveAction(emailType);
            this.EmailMessage = EmailStrings.GetMessageCorrectiveAction(correctiveAction, _emailSettings.Url, emailType);

            return(ExecutionResult.Next());
        }
        public void TwoCallsCreateTwoDifferentEMailAddresses()
        {
            var sut         = new EmailAddresses();
            var firstValue  = sut.GetValue();
            var secondValue = sut.GetValue();

            Assert.NotEqual(firstValue, secondValue);
        }
        public void EMailAddressMustBeValidWithRealNames()
        {
            var sut = new EmailAddresses();

            var value = sut.GetValue();

            Assert.True(RFC5322RegEx.IsMatch(value));
        }
        public void EMailAddressMustBeValidWithRealNames()
        {
            var sut = new EmailAddresses();

            var value = sut.GetValue();

            Assert.True(RFC5322RegEx.IsMatch(value));
        }
        public void EMailAddressMustBeValidWithRealNames()
        {
            var sut = new EmailAddresses();

            var value = sut.GetValue();

            StringAssert.Matches(value, RFC5322RegEx, StandardAssertMessage);
        }
Ejemplo n.º 21
0
        public Insuree()
        {
            Addresses      = new Addresses();
            EmailAddresses = new EmailAddresses();
            PhoneNumbers   = new PhoneNumbers();

            Insurances = new Insurances();
        }
        public void EMailAddressMustBeValidWithRealNames()
        {
            var sut = new EmailAddresses();

            var value = sut.GetValue();

            StringAssert.Matches(value, RFC5322RegEx, StandardAssertMessage);
        }
        public void TwoCallsCreateTwoDifferentEMailAddresses()
        {
            var sut = new EmailAddresses();
            var firstValue = sut.GetValue();
            var secondValue = sut.GetValue();

            Assert.AreNotEqual(firstValue, secondValue);
        }
 public static Email ToDomain(this EmailAddresses databaseEntity)
 {
     return(new Email
     {
         EmailAddress = databaseEntity.EmailAddress.Trim(),
         LastModified = databaseEntity.DateModified
     });
 }
Ejemplo n.º 25
0
        ///<summary>Gets new messages from email inbox, as well as older messages from the db. Also fills the grid.</summary>
        private int GetMessages()
        {
            AddressInbox = EmailAddresses.GetByClinic(0); //Default for clinic/practice.
            Cursor       = Cursors.WaitCursor;
            FillGridEmailMessages();                      //Show what is in db.
            Cursor = Cursors.Default;
            if (AddressInbox.Pop3ServerIncoming == "")    //Email address not setup.
            {
                Text         = "Email Inbox";
                AddressInbox = null;
                //todo: Message Box is too instrusive, move this to a status label.
                //MsgBox.Show(this,"Default email address has not been setup completely.");
                return(0);
            }
            Text = "Email Inbox for " + AddressInbox.EmailUsername;
            Application.DoEvents();                                                                         //So that something is showing while the page is loading.
            if (!CodeBase.ODEnvironment.IdIsThisComputer(PrefC.GetString(PrefName.EmailInboxComputerName))) //This is not the computer to get new messages from.
            {
                return(0);
            }
            if (PrefC.GetString(PrefName.EmailInboxComputerName) == "")
            {
                MsgBox.Show(this, "Computer name to fetch new email from has not been setup.");
                return(0);
            }
            Cursor = Cursors.WaitCursor;
            int emailMessagesTotalCount = 0;

            Text = "Email Inbox for " + AddressInbox.EmailUsername + " - Fetching new email...";
            try {
                bool hasMoreEmail = true;
                while (hasMoreEmail)
                {
                    List <EmailMessage> emailMessages = EmailMessages.ReceiveFromInbox(1, AddressInbox);
                    emailMessagesTotalCount += emailMessages.Count;
                    if (emailMessages.Count == 0)
                    {
                        hasMoreEmail = false;
                    }
                    else                       //Show messages as they are downloaded, to indicate to the user that the program is still processing.
                    {
                        FillGridEmailMessages();
                        Application.DoEvents();
                    }
                }
            }
            catch (Exception ex) {
                MessageBox.Show(Lan.g(this, "Error retrieving email messages") + ": " + ex.Message);
            }
            finally {
                Text = "Email Inbox for " + AddressInbox.EmailUsername;
            }
            Text = "Email Inbox for " + AddressInbox.EmailUsername + " - Resending any acknowledgments which previously failed...";
            EmailMessages.SendOldestUnsentAck(AddressInbox);
            Text   = "Email Inbox for " + AddressInbox.EmailUsername;
            Cursor = Cursors.Default;
            return(emailMessagesTotalCount);
        }
Ejemplo n.º 26
0
        public void Can_Generate_Valid_Human_Emails()
        {
            for (var i = 0; i < 200; i++)
            {
                var email = EmailAddresses.Human();

                Assert.IsTrue(_valid_email_regex.IsMatch(email), "Expected a valid email address");
            }
        }
Ejemplo n.º 27
0
        public void ConstructorWithInitialCollectionAddsToList()
        {
            var initial = new EmailAddresses {
                new EmailAddress(), new EmailAddress()
            };
            var emailAddresses = new EmailAddresses(initial);

            emailAddresses.Count.Should().Be(2);
        }
        public void EmailAddressesWorksInCombinationWithRealNamesPlugin()
        {
            var realNames = new RealNames(NameStyle.FirstNameLastName);

            var sut    = new EmailAddresses(realNames);
            var result = sut.GetValue();

            Assert.True(RFC5322RegEx.IsMatch(result));
        }
Ejemplo n.º 29
0
        public void ConstructorWithInitialIListAddsToList()
        {
            IList <EmailAddress> initial = new List <EmailAddress> {
                new EmailAddress(), new EmailAddress()
            };
            var emailAddresses = new EmailAddresses(initial);

            emailAddresses.Count.Should().Be(2);
        }
Ejemplo n.º 30
0
        public void Should_Include_Only_Major_Domain_Extensions_When_Flag_Is_Set_For_Human_Addresses()
        {
            var email = EmailAddresses.Human(true);

            var extensionPos = email.LastIndexOf('.');
            var extension    = email.Substring(extensionPos, email.Length - extensionPos);

            Assert.IsTrue(_major_domain_regex.IsMatch(extension));
        }
        public void EmailAddressesWorksInCombinationWithRealNamesPlugin()
        {
            var realNames = new RealNames(NameStyle.FirstNameLastName);

            var sut    = new EmailAddresses(realNames);
            var result = sut.GetValue();

            StringAssert.Matches(result, RFC5322RegEx, StandardAssertMessage);
        }
Ejemplo n.º 32
0
        private void FormClinicEdit_Load(object sender, System.EventArgs e)
        {
            textDescription.Text = ClinicCur.Description;
            string phone = ClinicCur.Phone;

            if (phone != null && phone.Length == 10 && Application.CurrentCulture.Name == "en-US")
            {
                textPhone.Text = "(" + phone.Substring(0, 3) + ")" + phone.Substring(3, 3) + "-" + phone.Substring(6);
            }
            else
            {
                textPhone.Text = phone;
            }
            string fax = ClinicCur.Fax;

            if (fax != null && fax.Length == 10 && Application.CurrentCulture.Name == "en-US")
            {
                textFax.Text = "(" + fax.Substring(0, 3) + ")" + fax.Substring(3, 3) + "-" + fax.Substring(6);
            }
            else
            {
                textFax.Text = fax;
            }
            textAddress.Text    = ClinicCur.Address;
            textAddress2.Text   = ClinicCur.Address2;
            textCity.Text       = ClinicCur.City;
            textState.Text      = ClinicCur.State;
            textZip.Text        = ClinicCur.Zip;
            textBankNumber.Text = ClinicCur.BankNumber;
            comboPlaceService.Items.Clear();
            comboPlaceService.Items.AddRange(Enum.GetNames(typeof(PlaceOfService)));
            comboPlaceService.SelectedIndex = (int)ClinicCur.DefaultPlaceService;
            for (int i = 0; i < ProviderC.ListShort.Count; i++)
            {
                comboInsBillingProv.Items.Add(ProviderC.ListShort[i].GetLongDesc());
            }
            if (ClinicCur.InsBillingProv == 0)
            {
                radioInsBillingProvDefault.Checked = true;              //default=0
            }
            else if (ClinicCur.InsBillingProv == -1)
            {
                radioInsBillingProvTreat.Checked = true;              //treat=-1
            }
            else
            {
                radioInsBillingProvSpecific.Checked = true;              //specific=any number >0. Foreign key to ProvNum
                comboInsBillingProv.SelectedIndex   = Providers.GetIndex(ClinicCur.InsBillingProv);
            }
            EmailAddress emailAddress = EmailAddresses.GetOne(ClinicCur.EmailAddressNum);

            if (emailAddress != null)
            {
                textEmail.Text = emailAddress.EmailUsername;
            }
        }
        public void PluginMustEnsureValidAddressesEvenAnInvalidDomainNameIsProvided()
        {
            var referenceValue = "googlecom";
            var fake = new FakeRandomizerPlugin<string>(referenceValue);

            var sut = new EmailAddresses(fake, fake);

            var result = sut.GetValue();
            Assert.True(RFC5322RegEx.IsMatch(result));
        }
Ejemplo n.º 34
0
        public bool SendEmail(EmailAddresses addresses, string subject, string body)
        {
            var actualMessage = new EmailMessage(addresses)
            {
                Subject = subject, Body = body
            };

            ActualMessages.Add(actualMessage);
            return(true);
        }
        public void PluginMustEnsureValidAddressesEvenAnInvalidDomainNameIsProvided()
        {
            var referenceValue = "googlecom";
            var fake = new FakeRandomizerPlugin<string>(referenceValue);

            var sut = new EmailAddresses(fake, fake);

            var result = sut.GetValue();

            StringAssert.Matches(result, RFC5322RegEx, StandardAssertMessage);
        }
        public void DomainNamesAreUsedFromRandomData()
        {
            var referenceValue = "google.com";
            var fake = new FakeRandomizerPlugin<string>(referenceValue);

            var sut = new EmailAddresses(fake, fake);

            var result = sut.GetValue();

            Assert.EndsWith(referenceValue, result);
            Assert.True(RFC5322RegEx.IsMatch(result));
        }
        public void LocalPathMustBeUsedFromRandomData()
        {
            var referenceValue = "karl";
            var fake = new FakeRandomizerPlugin<string>(referenceValue);

            var sut = new EmailAddresses(fake);

            var result = sut.GetValue();

            Assert.StartsWith(referenceValue, result);
            Assert.True(RFC5322RegEx.IsMatch(result));
        }
        public void DomainNamesAreUsedFromRandomData()
        {
            var referenceValue = "google.com";
            var fake = new FakeRandomizerPlugin<string>(referenceValue);

            var sut = new EmailAddresses(fake, fake);
            
            var result = sut.GetValue();

            StringAssert.EndsWith(result, referenceValue);
            StringAssert.Matches(result, RFC5322RegEx, StandardAssertMessage);
        }
        public void LocalPathMustBeUsedFromRandomData()
        {
            var referenceValue = "karl";
            var fake = new FakeRandomizerPlugin<string>(referenceValue);

            var sut = new EmailAddresses(fake);

            var result = sut.GetValue();

            StringAssert.StartsWith(result, referenceValue);
            StringAssert.Matches(result, RFC5322RegEx, StandardAssertMessage);
        }
        public void EmailAddressesWorksInCombinationWithRealNamesPlugin()
        {
            var realNames = new RealNames(NameStyle.FirstNameLastName);

            var sut = new EmailAddresses(realNames);
            var result = sut.GetValue();

            Assert.True(RFC5322RegEx.IsMatch(result));
        }
 public void DefaultModeShouldReturnValidEmailAdress()
 {
     var value = new EmailAddresses().GetValue();
     Assert.True(RFC5322RegEx.IsMatch(value));
 }
        public void GivenDomainRootIsAttachedToGeneratedEmailAddress()
        {
            var domainRoot = ".de";
            var sut = new EmailAddresses(domainRoot);

            var result = sut.GetValue();

            Assert.EndsWith(domainRoot, result);
            Assert.True(RFC5322RegEx.IsMatch(result));
        }
        public void GivenDomainRootIsAttachedToGeneratedEmailAddress()
        {
            var domainRoot = ".de";
            var sut = new EmailAddresses(domainRoot);

            var result = sut.GetValue();

            StringAssert.EndsWith(result, domainRoot);
            StringAssert.Matches(result, RFC5322RegEx, StandardAssertMessage);
        }
        public void EmailAddressesWorksInCombinationWithRealNamesPlugin()
        {
            var realNames = new RealNames(NameStyle.FirstNameLastName);

            var sut = new EmailAddresses(realNames);
            var result = sut.GetValue();

            StringAssert.Matches(result, RFC5322RegEx, StandardAssertMessage);
        }
        public void DefaultModeShouldReturnValidEmailAdress()
        {
            var value = new EmailAddresses().GetValue();

            StringAssert.Matches(value, RFC5322RegEx, StandardAssertMessage);
        }