public void WhenOverwritingTheValueAppearsOnThePaper(string text, string expectedResult) { var testString = "An apple a day keeps the doctor away"; var pencil = new Pencil(1000, 5, 100); var paper = new Paper(); pencil.Write(testString, ref paper); pencil.Erase("apple", ref paper); pencil.Rewrite(text, ref paper); Assert.Equal(expectedResult, paper.Content); }
public void WhenRewritingNothingItDoesNotThrowEx() { var pencil = new Pencil(); var paper = new Paper(); try { pencil.Rewrite(string.Empty, ref paper); } catch { Assert.True(false, "Exception thrown when calling Rewrite"); } }
public void WhenOverwritingThePointDurabilityIsReduced(string text, int expectedResult) { var testString = "An apple a day keeps the doctor away"; var initialDurability = 1000; var pencil = new Pencil(initialDurability, 5, 100); var paper = new Paper(); pencil.Write(testString, ref paper); pencil.Sharpen(); pencil.Erase("apple", ref paper); pencil.Rewrite(text, ref paper); Assert.Equal(initialDurability - expectedResult, pencil.Durability); }