Ejemplo n.º 1
0
        public void Rename_CharacterDelimiter_DelimitersArentCapitalized()
        {
            // Arrange
            var name          = "thisxisxmyxname";
            var toCamelCaseOp = new ToCamelCaseOperation();

            toCamelCaseOp.DelimiterCharacters = "x";

            var expected = new RenameResult()
            {
                new Diff("thisx", DiffOperation.Equal),
                new Diff("i", DiffOperation.Deletion),
                new Diff("I", DiffOperation.Insertion),
                new Diff("sx", DiffOperation.Equal),
                new Diff("m", DiffOperation.Deletion),
                new Diff("M", DiffOperation.Insertion),
                new Diff("yx", DiffOperation.Equal),
                new Diff("n", DiffOperation.Deletion),
                new Diff("N", DiffOperation.Insertion),
                new Diff("ame", DiffOperation.Equal),
            };

            // Act
            var result = toCamelCaseOp.Rename(name, 0);

            // Assert
            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 2
0
        public void Rename_DashDelimeterIsEscaped_OnlyMatchesSpace()
        {
            // Arrange
            var name          = "GameObject";
            var toCamelCaseOp = new ToCamelCaseOperation();

            // Dash is a special character in regex, would meaning to use "space' through "Underscore" if
            // not properly escaped.
            toCamelCaseOp.DelimiterCharacters = " -_";

            var expected = new RenameResult()
            {
                new Diff("G", DiffOperation.Deletion),
                new Diff("g", DiffOperation.Insertion),
                new Diff("ameObject", DiffOperation.Equal),
            };

            // Act
            var result = toCamelCaseOp.Rename(name, 0);

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