Exemple #1
0
        public void CanShortenTextWithoutSpaces()
        {
            var limit   = 50;
            var newText = TextManipulations.ShortenText(RandomValueGenerator.AlphaNumericText(100, 200), limit);

            Assert.AreEqual(limit + EllipsisLength, newText.Length);
        }
Exemple #2
0
        public void CanStripSectionsWhenSummarizing()
        {
            var section = $"[{RandomValueGenerator.AlphaNumericText(10, 20)}]";
            var text    = $"{RandomValueGenerator.AlphaNumericTextWithSpaces(10, 20)}\n{section}";
            var newText = TextManipulations.Summarize(text);

            Assert.IsFalse(newText.Contains(section));
        }
Exemple #3
0
        public void CanShortenTextByNotTruncatingShortText()
        {
            var limit      = 50;
            var textLength = RandomValueGenerator.Integer(30, 40);
            var newText    = TextManipulations.ShortenText(RandomValueGenerator.AlphaNumericText(textLength), limit);

            Assert.AreEqual(textLength, newText.Length);
        }
Exemple #4
0
        public void CanShortenTextWithSpaces()
        {
            var limit         = 50;
            var spacePosition = RandomValueGenerator.Integer(100, 200);
            var text          = $"{RandomValueGenerator.AlphaNumericText(spacePosition)} {RandomValueGenerator.AlphaNumericText(100, 200)}";

            var newText = TextManipulations.ShortenText(text, limit);

            Assert.AreEqual(spacePosition + EllipsisLength, newText.Length);
        }
Exemple #5
0
        public void CanSaveFolderName()
        {
            var context = Provider.GetContext();

            var newId = context.Folders.Add(ModelGenerator.Folder());

            // Edit existing Folder name and save
            var folder = context.Folders.GetItem(newId);

            folder.Name = RandomValueGenerator.AlphaNumericText(10, 200);
            context.Folders.Save(folder);

            // Get saved Folder and check values
            var savedFolder = context.Folders.GetItem(newId);

            ModelAssert.AreEqual(folder, savedFolder);
        }
Exemple #6
0
        public void CanSaveDocumentText()
        {
            var context = Provider.GetContext();

            var newId = context.Documents.Add(ModelGenerator.Document(FolderId));

            // Edit existing document name and save
            var document = context.Documents.GetItem(newId);

            document.Text = RandomValueGenerator.AlphaNumericText(200, 2000);
            context.Documents.Save(document);

            // Get saved document and check values
            var savedDocument = context.Documents.GetItem(newId);

            ModelAssert.AreEqual(document, savedDocument);
        }
Exemple #7
0
 public void CanCallShortenText()
 {
     TextManipulations.ShortenText(RandomValueGenerator.AlphaNumericText(100, 200), 50);
 }