Example #1
0
        public void WhenCopyParamsWithinValue_ThenPaste(int copyPosition, int copyLength, int pastePosition, string expected)
        {
            var sut = new CopyPasteCommand(copyPosition, copyLength, pastePosition).SetValue(Value);

            sut.Execute();

            Assert.That(sut.Result, Is.EqualTo(expected));
        }
Example #2
0
        public void WhenCopyLengthWouldGoOutOfRange_ThenCopyTillEnd(int copyPosition, int copyLength, int pastePosition, string expected)
        {
            var sut = new CopyPasteCommand(copyPosition, copyLength, pastePosition).SetValue(Value);

            sut.Execute();

            Assert.That(sut.Result, Is.EqualTo(expected));
        }
Example #3
0
        public void WhenPastePositionGreaterThanLength_ThenPasteAtEnd()
        {
            var sut = new CopyPasteCommand(0, 4, Value.Length + 1).SetValue(Value);

            sut.Execute();

            Assert.That(sut.Result, Is.EqualTo(Value + "John"));
        }
Example #4
0
        public void WhenCopyPositionEqualsOrGreaterThanValueLength_ThenSetToSame(int copyPosition, int copyLength, int pastePosition)
        {
            var sut = new CopyPasteCommand(copyPosition, copyLength, pastePosition).SetValue(Value);

            sut.Execute();

            Assert.That(sut.Result, Is.EqualTo(Value));
        }
Example #5
0
        public void WhenCopyLengthIsLessThanOne_ThenSetToSame()
        {
            var sut = new CopyPasteCommand(0, 0, 5).SetValue(Value);

            sut.Execute();

            Assert.That(sut.Result, Is.EqualTo(Value));
        }
Example #6
0
        public void WhenValueIsNull_ThenSetToNull()
        {
            var sut = new CopyPasteCommand(0, 2, 5);

            sut.Execute();

            Assert.That(sut.Result, Is.Null);
        }