Esempio n. 1
0
        public void Verify_TextNormalization()
        {
            INormalizable normalizer = new TextNormalizationService();

            var text           = "Français Gaëlle impôt München, Österreich. Úber à dépôt.";
            var normalizedText = normalizer.NormalizeText(text);
            var exprectedText  = "francais gaelle impot munchen, osterreich. uber a depot.";

            Assert.AreEqual(normalizedText, exprectedText);
        }
Esempio n. 2
0
        public void Verify_MultiBlankSpaceRemoval()
        {
            INormalizable normalizer = new TextNormalizationService();

            var text           = "This is a          sample      text\r\n       .";
            var normalizedText = normalizer.RemoveMultiSpaces(text);
            var expectedText   = "This is a sample text .";

            Assert.AreEqual(normalizedText, expectedText);
        }
        protected void btnCreateNewAcknowledgement_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txtbBeneficiary.Value) &&
                !string.IsNullOrWhiteSpace(txtbContent.Value) &&
                !string.IsNullOrWhiteSpace(txtbTags.Value))
            {
                INormalizable textNormalizer     = new TextNormalizationService();
                var           acknowledgementDto = new AcknowledgementDTO();
                acknowledgementDto.AuthorUsername = HttpContext.Current.User.Identity.Name;

                try
                {
                    if (!string.IsNullOrWhiteSpace(hfUserUsername.Value))
                    {
                        acknowledgementDto.BeneficiaryUsername = hfUserUsername.Value;
                    }
                    else if (Request.QueryString[Global.Beneficiary] != null)
                    {
                        acknowledgementDto.BeneficiaryUsername = Request.QueryString[Global.Beneficiary];
                    }
                    else
                    {
                        // Transform full name to username
                        acknowledgementDto.BeneficiaryUsername = ldapAccountService.ReadUserUsername(txtbBeneficiary.Value.Trim());
                        txtbBeneficiary.Value = string.Empty;
                    }

                    CreateAcknowledgement(textNormalizer, acknowledgementDto);

                    SendBeneficiaryEmail(acknowledgementDto.AuthorUsername, acknowledgementDto.BeneficiaryUsername);

                    ClearAndRedirect();
                }
                catch (ArgumentException ex)
                {
                    lblError.Visible   = true;
                    lblError.InnerText = ex.Message;
                }
                // TODO: Remove
                catch (Exception ex)
                {
                    lblError.Visible   = true;
                    lblError.InnerText = ex.Message;
                }
            }
        }