Esempio n. 1
0
        public void RemoveCharacters_EmptyTarget_IsUnchanged()
        {
            // Arrange
            var name = string.Empty;
            var removeCharactersOp = new RemoveCharactersOperation();

            var expected = string.Empty;

            // Act
            string result = removeCharactersOp.Rename(name, 0);

            // Assert
            Assert.AreEqual(expected, result);
        }
Esempio n. 2
0
        public void RemoveCharacters_RemoveSymbols_RemovesOnlySymbols()
        {
            // Arrange
            var name = "A!@#$%BD*(";
            var removeCharactersOp = new RemoveCharactersOperation();

            removeCharactersOp.Characters = "!@#$%^&*()";

            var expected = "ABD";

            // Act
            string result = removeCharactersOp.Rename(name, 0);

            // Assert
            Assert.AreEqual(expected, result);
        }
Esempio n. 3
0
        public void RemoveNumbers_AllNumbersInString_RemovesAllNumbers()
        {
            // Arrange
            var name = "1234567890";
            var removeCharactersOp = new RemoveCharactersOperation();

            removeCharactersOp.Options = RemoveCharactersOperation.Numbers;

            var expected = string.Empty;

            // Act
            string result = removeCharactersOp.Rename(name, 0);

            // Assert
            Assert.AreEqual(expected, result);
        }
Esempio n. 4
0
        public void RemoveNumbers_LettersAndNumbersInString_RemovesOnlyNumbers()
        {
            // Arrange
            var name = "A251B637k911p";
            var removeCharactersOp = new RemoveCharactersOperation();

            removeCharactersOp.Options = RemoveCharactersOperation.Numbers;

            var expected = "ABkp";

            // Act
            string result = removeCharactersOp.Rename(name, 0);

            // Assert
            Assert.AreEqual(expected, result);
        }
Esempio n. 5
0
        public void RemoveSymbols_OnlySymbolsInString_RemovesAllSymbols()
        {
            // Arrange
            var name = "`~!@#$%^&*()+-=[]{}\\|;:'\",<.>/?";
            var removeCharactersOp = new RemoveCharactersOperation();

            removeCharactersOp.Options = RemoveCharactersOperation.Symbols;

            var expected = string.Empty;

            // Act
            string result = removeCharactersOp.Rename(name, 0);

            // Assert
            Assert.AreEqual(expected, result);
        }
Esempio n. 6
0
        public void RemoveSymbols_SymbolsAndAlphanumericsInString_RemovesOnlySymbols()
        {
            // Arrange
            var name = "A!@#$%BD*(";
            var removeCharactersOp = new RemoveCharactersOperation();

            removeCharactersOp.Options = RemoveCharactersOperation.Symbols;

            var expected = "ABD";

            // Act
            string result = removeCharactersOp.Rename(name, 0);

            // Assert
            Assert.AreEqual(expected, result);
        }
Esempio n. 7
0
        public void RemoveCustomCharacters_ValidString_RemovesCustomChars()
        {
            // Arrange
            var name = "abz35!450k";
            var removeCharactersOp = new RemoveCharactersOperation();

            removeCharactersOp.Options = new RemoveCharactersOperation.RemoveCharactersOperationOptions()
            {
                CharactersToRemove = "ak!5"
            };

            var expected = "bz340";

            // Act
            string result = removeCharactersOp.Rename(name, 0);

            // Assert
            Assert.AreEqual(expected, result);
        }
Esempio n. 8
0
        public void RemoveCustomCaseSensitiveCharacters_MixedCasesInString_RemovesCasedCustomChars()
        {
            // Arrange
            var name = "ABCDabcdD";
            var removeCharactersOp = new RemoveCharactersOperation();

            removeCharactersOp.Options = new RemoveCharactersOperation.RemoveCharactersOperationOptions()
            {
                CharactersToRemove = "ABCD",
                IsCaseSensitive    = true
            };

            var expected = "abcd";

            // Act
            string result = removeCharactersOp.Rename(name, 0);

            // Assert
            Assert.AreEqual(expected, result);
        }