public void TestEditAddsToFirstBlankSpaceOnPaper() { // Act paper.Text += pencil.Write(testSentenceWithSpace); paper.Text = pencil.Edit("test", paper.Text); // Assert Assert.AreEqual(genericTestSentence, paper.Text, "Test sentence should match paper text, edit should add word to first blank area in sentence"); }
public void WhenEditingIfPointDurabilityIsExhaustedPencilWritesWhitespaces() { Pencil pencil = new Pencil(3, 10, 10); String paper = pencil.Erase("Mary had a little lamb", "had a"); Assert.Equal("Mary kic little lamb", pencil.Edit(paper, "kicked", pencil.EditIndex)); }
public void WhenEditingPencilDurabilityIsImpactedByCharacterCase() { Pencil pencil = new Pencil(4, 10, 10); String paper = pencil.Erase("Mary had a little lamb", "Mary had"); Assert.Equal("Joh a little lamb", pencil.Edit(paper, "John", pencil.EditIndex)); }
public void EditCannotOccurIfEraseHasNotFirstOccurred() { Pencil pencil = new Pencil(5, 5, 5); String paper = "Mary had a little lamb"; Assert.Equal(paper, pencil.Edit(paper, "wolf", pencil.EditIndex)); }
public void EditOccursAtLastEditIndexSetWhenEraseHasBeenCalledMultipleTimes() { Pencil pencil = new Pencil(5, 10, 10); String paper = pencil.Erase("Mary had a little lamb", "had"); paper = pencil.Erase(paper, "lamb"); Assert.Equal("Mary a little goat", pencil.Edit(paper, "goat", pencil.EditIndex)); }
public void WhenEditPassedNewTextInsertsThatText() { Pencil pencil = new Pencil(5, 20, 20, "An apple a day"); pencil.Erase("apple"); string word = "onion"; pencil.Edit(word); Assert.AreEqual("An onion a day", pencil.Paper); }
public void WhenEditingAndTheNewTextIsLongerThanTheWhitespaceThenTheCharacterCollisionsAreReplacedWithASymbol() { var pencil = new Pencil(250, 3, 20); pencil.Write("An apple a day keeps the doctor away"); pencil.Erase("apple"); pencil.Edit("artichoke"); Assert.AreEqual("An artich@k@ay keeps the doctor away", pencil.Paper); }
public void WhenThePencilEditsItReplacesSpacesWithTheNewText() { var pencil = new Pencil(250, 3, 20); pencil.Write("An apple a day keeps the doctor away"); pencil.Erase("apple"); pencil.Edit("onion"); Assert.AreEqual("An onion a day keeps the doctor away", pencil.Paper); }
public void When_Edit_Expect_PaperToHaveEditTextCalledWithGivenEditText() { var editText = "edit"; var pencil = new Pencil(paperMock.Object, 100, 5, 100); pencil.Edit(editText); paperMock.Verify(_paper => _paper.EditText(It.Is <string>(p => p == editText)), Times.Once); }
public void WhenEditPassedStringThatCollidesWithExistingTextCollsionsReplacedWithAtSymbol() { Pencil pencil = new Pencil(5, 20, 20, "An apple a day"); pencil.Erase("apple"); string newText = "artichoke"; pencil.Edit(newText); Assert.AreEqual("An artich@k@ay", pencil.Paper); }
public void WhenEditPassedTextWithTwoCollisionsOneUpperCaseSixLowerCaseCharsPointDurabilityDecreasesByTen() { Pencil pencil = new Pencil(5, 20, 20, "An apple a day"); pencil.Erase("apple"); string newText = "ArtichOke"; pencil.Edit(newText); Assert.AreEqual(10, pencil.PointDurability); }
public void WhenEditPassedStringLongerThanPaperAppendsExcessCharsToPaper() { Pencil pencil = new Pencil(5, 20, 20, "Buffalo Bill"); pencil.Erase("Bill"); string newText = ("William"); pencil.Edit(newText); Assert.AreEqual("Buffalo William", pencil.Paper); }
public void Edit_Test() { Pencil _pencil = new Pencil(4000, 1000, 300); _pencil.Write("An onion a day keeps the doctor away"); _pencil.Erase("onion"); _pencil.Edit("artichoke"); Assert.AreEqual("An artich@k@ay keeps the doctor away", _pencil.FullText); }
public void WhenEditMethodCalledAddsCharsAtIndexWithoutCollision() { Pencil pencil = new Pencil(500, 5); Paper paper = new Paper(); Eraser eraser = new Eraser(20); pencil.Write("Hello World", paper); eraser.Erase("World", paper); pencil.Edit("Howdy", paper); Assert.AreEqual("Hello Howdy", paper.Text); }
public void WhenEditMethodCalledIfOverwriteCharIsSpaceDoNotReplaceOriginalChar() { Pencil pencil = new Pencil(500, 5); Paper paper = new Paper(); Eraser eraser = new Eraser(20); pencil.Write("Hello World", paper); eraser.Erase("Wor", paper); pencil.Edit("hey u", paper); Assert.AreEqual("Hello heyl@", paper.Text); }
public void WhenEditMethodCalledIfCharsCollideExistingCharOverwrittenWithSpecialChar() { Pencil pencil = new Pencil(500, 5); Paper paper = new Paper(); Eraser eraser = new Eraser(20); pencil.Write("Hello World", paper); eraser.Erase("lo", paper); pencil.Edit("Howdy", paper); Assert.AreEqual("HelHow@@rld", paper.Text); }
public void EditShouldReplaceErasedText() { string inputText = "An apple a day keeps the doctor away"; string expectedText = "An onion a day keeps the doctor away"; string actualText; Pencil pencil = new Pencil(20, 20, 20); pencil.Written = inputText; pencil.Edit("apple", "onion"); actualText = pencil.Written; Assert.AreEqual(expectedText, actualText); }
public void EditShouldKeepSpacesIfReplacementIsTooShort() { string inputText = "An apple a day keeps the doctor away"; string expectedText = "An owl a day keeps the doctor away"; string actualText; Pencil pencil = new Pencil(20, 20, 20); pencil.Written = inputText; pencil.Edit("apple", "owl"); actualText = pencil.Written; Assert.AreEqual(expectedText, actualText); }
public void EditShouldReplaceErasedTextWithSymbolIfTooLong() { string inputText = "An apple a day keeps the doctor away"; string expectedText = "An artich@k@ay keeps the doctor away"; string actualText; Pencil pencil = new Pencil(20, 20, 20); pencil.Written = inputText; pencil.Edit("apple", "artichoke"); actualText = pencil.Written; Assert.AreEqual(expectedText, actualText); }
public void EditsInsertTextIntoWhitespaceFromLastDelete() { Assert.Equal("Lorem quinc dolor sit amet", pencil.Edit("quinc")); }
public void EditCanReplaceErasedWordWithANewWord() { String paper = pencil.Erase("Mary had a little lamb", "lamb"); Assert.Equal("Mary had a little bird", pencil.Edit(paper, "bird", pencil.EditIndex)); }
public void PencilEditMethodReceivesErasedStringFromEraseMethodWhenItIsCalledTest() { paper.Text = "This is a test string"; Assert.AreEqual("This is a string", pencil.Edit(paper, "test", " ")); }