public void WhenAPencilErasesTextItReplacesTextWithWhiteSpace() { paper.AddContent("Now You See Me"); pencil.Erase(paper, "See"); Assert.IsTrue(!paper.content.Contains("See")); }
public void PencilEditMethodDoesNotAlterPaperTextPropertyWhenRemainingEraserIsZeroTest() { paper.Text = "test"; pencil.RemainingEraser = 0; pencil.Erase(paper, "test", out int startIndex); Assert.AreEqual("test", paper.Text); }
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 WhenErasingTwiceTheLastTwoWordsAreRemoved() { var pencil = new Pencil(); var paper = new Paper(); pencil.Write(ErasingTestText, ref paper); pencil.Erase("chuck", ref paper); pencil.Erase("chuck", ref paper); Assert.Equal(paper.Content, "How much wood would a woodchuck chuck if a wood could wood?"); }
public void WhenAPencilErasesTextTwiceTheLastTwoOccurrencesAreReplacedWithSpaces() { var pencil = new Pencil(250, 3, 200); pencil.Write("How much wood would a woodchuck chuck if a woodchuck could chuck wood?"); pencil.Erase("chuck"); pencil.Erase("chuck"); Assert.AreEqual("How much wood would a woodchuck chuck if a wood could wood?", pencil.Paper); }
public void WhenErasingTheEraserStopsWorkingWhenCompletelyDegradedWithMultipleErases() { var pencil = new Pencil(1000, 5, 10); var paper = new Paper(); pencil.Write(ErasingTestText, ref paper); pencil.Erase("wood", ref paper); pencil.Erase("wood", ref paper); pencil.Erase("wood", ref paper); Assert.Equal("How much wood would a wo chuck chuck if a chuck could chuck ?", paper.Content); }
public void WhenErasePassedStringofTwoCharsEraserDurabilityDecreasesByTwo() { Pencil pencil = new Pencil(5, 20, 20, "ab"); pencil.Erase("ab"); Assert.AreEqual(18, pencil.EraserDurability); }
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 WhenAPencilHasInsufficientEraserDurabilityItErasesAsManyCharactersAsItHasDurability() { Pencil pencil = new Pencil(10, 5, 5); String paper = "Mary had a little lamb"; Assert.Equal("Mary had a l lamb", pencil.Erase(paper, "little")); }
public void AfterErasingPartialWordWordTheEditIndexPropertyIsSetTwo() { Pencil pencil = new Pencil(10, 10, 3); String paper = pencil.Erase("Mary had a little lamb", "Mary"); Assert.Equal(1, pencil.EditIndex); }
public void AfterErasingEntireWordTheEditIndexPropertyIsSet() { Pencil pencil = new Pencil(5, 5, 5); String paper = pencil.Erase("Mary had a little lamb", "lamb"); Assert.Equal(18, pencil.EditIndex); }
public void WhenErasePassedTextToEraseWithTwoInstancesofSameWordRemovesLastInstanceOfWordFromString() { Pencil pencil = new Pencil(5, 30, 30, "how much wood can a woodchuck"); pencil.Erase("wood"); Assert.AreEqual("how much wood can a chuck", pencil.Paper); }
public void AfterErasingWholePhraseWithWhitespacesTheEditIndexPropertyIsSet() { Pencil pencil = new Pencil(20, 20, 10); String paper = pencil.Erase("Mary had a little lamb", "had a little"); Assert.Equal(5, pencil.EditIndex); }
public void WhenErasePassedStringItErasesOppositeOrderStringWasWrittenAndReplacesWithWhiteSpace() { Pencil pencil = new Pencil(5, 20, 1, "Bill"); pencil.Erase("Bill"); Assert.AreEqual("Bil ", pencil.Paper); }
public void WhenPencilEraserIsZeroAndItErases_PaperTextIsUnchanged() { pencil = new Pencil(defaultDurability, defaultLength, 0); sheet = new Paper("Nothing ever changes"); pencil.Erase("changes", sheet); Assert.AreEqual("Nothing ever changes", sheet.Text); }
public void WhenAPencilErasesRepeatedTextInASingleWordEraseTheLastOccurance() { pencil = new Pencil(100, 8, 5); paper.AddContent("BamBam"); pencil.Erase(paper, "Bam"); Assert.AreEqual("Bam ", paper.content); }
public void WhenErasePassedWhiteSpaceEraserDurabilityIsNotAffectedByWhiteSpace() { Pencil pencil = new Pencil(5, 20, 20, "test test"); string textToErase = " "; pencil.Erase(textToErase); Assert.AreEqual(18, pencil.EraserDurability); }
public void WhenErasePassedOneCharEraserDurabilityDecreasesByOne() { Pencil pencil = new Pencil(5, 20, 20, "a"); string textToErase = "a"; pencil.Erase(textToErase); Assert.AreEqual(19, pencil.EraserDurability); }
public void WhenPencilErases_EraserIsNotReducedByWhitespaceCharacters() { pencil = new Pencil(defaultDurability, defaultLength, defaultEraser); sheet = new Paper("Unless you are trying to change nothing"); pencil.Erase("trying to change", sheet); Assert.AreEqual(defaultEraser - 14, pencil.Eraser); }
public void WhenPencilErases_EraserIsReducedByNumOfNonwhitespaceCharacters() { pencil = new Pencil(defaultDurability, defaultLength, defaultEraser); sheet = new Paper("Except when they do"); pencil.Erase("when", sheet); Assert.AreEqual(defaultEraser - 4, pencil.Eraser); }
public void WhenAPencilErasesItDegradesByOne() { pencil = new Pencil(100, 8, 5); paper.AddContent("Erase"); pencil.Erase(paper, "Erase"); Assert.AreEqual(0, pencil.eraserDurability); }
public void WhenAPencilErasesBeyondItsDurabilityDoNotRemoveRemainingText() { pencil = new Pencil(100, 8, 5); paper.AddContent("What Remains"); pencil.Erase(paper, "What Remains"); Assert.AreEqual("What Re ", paper.content); }
public void Pencil_Erase_Empty_Paper_Does_Nothing() { var pncl = new Pencil(1000, 10, 50); var ppr = new Paper(); Assert.That(pncl.Erase(ppr, "zap"), Is.EqualTo(false)); Assert.That(ppr.Text, Is.EqualTo("")); }
public void Pencil_Erase_White_Space_Doesnt_Degrade_Eraser() { var pncl = new Pencil(1000, 10, 50); var ppr = new Paper(); pncl.Write(ppr, "The quick brown fox jumped over the lazy dog"); Assert.That(pncl.Erase(ppr, "fox jumped over"), Is.EqualTo(true)); Assert.That(pncl.EraserLength, Is.EqualTo(37)); }
public void Pencil_Erase_Long_Text_Degrades_Eraser() { var pncl = new Pencil(10000, 10, 10000); var ppr = new Paper(); pncl.Write(ppr, new string('a', 9000)); Assert.That(pncl.Erase(ppr, new string('a', 8500)), Is.EqualTo(true)); Assert.That(pncl.EraserLength, Is.EqualTo(1500)); }
public void Pencil_Erase_Short_Text_Degrades_Eraser() { var pncl = new Pencil(1000, 10, 50); var ppr = new Paper(); pncl.Write(ppr, "The quick brown fox jumped over the lazy dog"); Assert.That(pncl.Erase(ppr, "v"), Is.EqualTo(true)); Assert.That(pncl.EraserLength, Is.EqualTo(49)); }
public void Pencil_Erase_Null_Text() { var pncl = new Pencil(1000, 10, 50); var ppr = new Paper(); pncl.Write(ppr, "The quick brown fox jumped over the lazy dog"); Assert.That(pncl.Erase(ppr, null), Is.EqualTo(true)); Assert.That(ppr.Text, Is.EqualTo("The quick brown fox jumped over the lazy dog")); }
public void Pencil_Erase_Complete_Text() { var pncl = new Pencil(10000, 10, 10000); var ppr = new Paper(); pncl.Write(ppr, LorumIpsum.Text); Assert.That(pncl.Erase(ppr, LorumIpsum.Text), Is.EqualTo(true)); Assert.That(ppr.Text, Is.EqualTo(new string(' ', LorumIpsum.Text.Length))); }
public void Pencil_Erase_Long_Text() { var pncl = new Pencil(10000, 10, 10000); var ppr = new Paper(); pncl.Write(ppr, LorumIpsum.Text); Assert.That(pncl.Erase(ppr, LorumIpsum.MiddleChunk), Is.EqualTo(true)); Assert.That(ppr.Text, Is.EqualTo(LorumIpsum.Text.Replace(LorumIpsum.MiddleChunk, new string(' ', LorumIpsum.MiddleChunk.Length)))); }