コード例 #1
0
        public void CursorPositionFixer_PostSingleCRLF_ReturnsSamePosition()
        {
            var initialCursorPosition = 3;
            var fixer = new CursorPositionFixer();

            var fixedCursorPosition = fixer.Fix(
                file: CRLFEndingFile(),
                cursorPosition: initialCursorPosition);

            var realCursorPosition = 3;
            Assert.AreEqual(realCursorPosition, fixedCursorPosition);
        }
コード例 #2
0
        public void CursorPositionFixer_PreCRLF_ReturnsSamePositionMinusOne()
        {
            var initialCursorPosition = 1;
            var fixer = new CursorPositionFixer();

            var fixedCursorPosition = fixer.Fix(
                file: CRLFEndingFile(),
                cursorPosition: initialCursorPosition);

            var realCursorPosition = initialCursorPosition - 1;
            Assert.AreEqual(realCursorPosition, fixedCursorPosition);
        }
コード例 #3
0
        public void CursorPositionFixer_PostMultipleCRLF_ReturnsPositionPlusCRMinusOne()
        {
            var initialCursorPosition = 10;
            var fixer = new CursorPositionFixer();

            var fixedCursorPosition = fixer.Fix(
                file: CRLFEndingFile(),
                cursorPosition: initialCursorPosition);

            var realCursorPosition = 12;
            Assert.AreEqual(realCursorPosition, fixedCursorPosition);
        }
コード例 #4
0
        public void CursorPositionFixer_WithMissingFile_ReturnsSamePosition()
        {
            var initialCursorPosition = 1;
            var fixer = new CursorPositionFixer();

            var fixedCursorPosition = fixer.Fix(
                file: @"C:\missing.file",
                cursorPosition: initialCursorPosition);

            Assert.AreEqual(initialCursorPosition, fixedCursorPosition);
        }