public void Sharpen(IPencil pencil) { Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("sharpening the pencil..."); Console.ResetColor(); pencil.AfterSharpening(); }
public void sharpenPencil(IPencil pencil) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Sharpning the pencil..."); Console.ResetColor(); pencil.afterSharpening(); }
public void Sharpen(IPencil pencil) { //We are sharpening the pencil that passed in as a parameter. Now it can write to max again. Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Sharpening the pencil..."); Console.ResetColor(); pencil.AfterSharpening(); }
public void Sharpen(IPencil pencil) { Console.ForegroundColor = ConsoleColor.DarkYellow; Console.WriteLine("Sharpening pencil..."); Console.ResetColor(); pencil.AfterSharpening(); }
public void ShouldNeverBecomeNegative(string sentence, int startPointDurability) { const int expectedPointDurability = 0; IPencil pencil = GetPencil(pointDurability: startPointDurability); pencil.Write(GetPaper(), sentence); Assert.Equal(expectedPointDurability, pencil.CurrentPointDurability); }
public void ShouldReplaceMatchingTextWithCorrectAmountOfSpaces(string testWord, string expected) { IPencil pencil = GetPencil(); IPaper paper = GetPaper(testWord); pencil.Erase(paper, testWord); Assert.Equal(expected, paper.Text); }
public void ShouldMakeValuePositiveForNegativeLength() { const int startLength = -10; const int expectedLength = 10; IPencil pencil = GetPencil(length: startLength); Assert.Equal(expectedLength, pencil.CurrentLength); }
public void ShouldMakeValuePositiveForNegativeEraserDurability() { const int startEraserDurability = -10; const int expectedEraserDurability = 10; IPencil pencil = GetPencil(eraserDurability: startEraserDurability); Assert.Equal(expectedEraserDurability, pencil.CurrentEraserDurability); }
public void ShouldDegradeCorrectlyForMixedCaseAndWhitespace(string mixedString, int degradeAmount) { const int startPointDurability = 40; int expectedPointDurability = startPointDurability - degradeAmount; IPencil pencil = GetPencil(pointDurability: startPointDurability); pencil.Write(GetPaper(), mixedString); Assert.Equal(expectedPointDurability, pencil.CurrentPointDurability); }
public void ShouldDegradCorrectlyforManyRandomCharacters(string miscCharacters) { const int startPointDurability = 20; int expectedPointDurability = startPointDurability - miscCharacters.Length; IPencil pencil = GetPencil(pointDurability: startPointDurability); pencil.Write(GetPaper(), miscCharacters); Assert.Equal(expectedPointDurability, pencil.CurrentPointDurability); }
public void ShouldDegradeCorrectlyForManyLowercaseLetters(string lowercaseLetters) { const int startPointDurability = 20; int expectedPointDurability = startPointDurability - lowercaseLetters.Length; IPencil pencil = GetPencil(pointDurability: startPointDurability); pencil.Write(GetPaper(), lowercaseLetters); Assert.Equal(expectedPointDurability, pencil.CurrentPointDurability); }
public void ShouldAddTextToPaper() { const string testSentence = "This is a sentence"; IPencil pencil = GetPencil(); IPaper paper = GetPaper(); pencil.Write(paper, testSentence); Assert.Equal(testSentence, paper.Text); }
public void ShouldRemoveMatchingText() { const string testWord = "word"; IPencil pencil = GetPencil(); IPaper paper = GetPaper(testWord); pencil.Erase(paper, testWord); Assert.DoesNotContain(testWord, paper.Text); }
public void ShouldNotAllowLengthToBecomeNegative() { const int startLength = 0; const int expectedLength = 0; IPencil pencil = GetPencil(length: startLength); pencil.Sharpen(); Assert.Equal(expectedLength, pencil.CurrentLength); }
public void ShouldSharpenToThePositiveValueForNegativeDurability() { const int startPointDurability = -10; const int expectedPointDurability = 10; IPencil pencil = GetPencil(pointDurability: startPointDurability); pencil.Sharpen(); Assert.Equal(expectedPointDurability, pencil.CurrentPointDurability); }
public void ShouldReducePencilLengthByOne() { const int startLength = 5; const int expectedLength = 4; IPencil pencil = GetPencil(length: startLength); pencil.Sharpen(); Assert.Equal(expectedLength, pencil.CurrentLength); }
public void ShouldNeverBecomeNegative(string sentence, int startEraserDurability) { const int expectedEraserDurability = 0; IPencil pencil = GetPencil(eraserDurability: startEraserDurability); IPaper paper = GetPaper(sentence); pencil.Erase(paper, sentence); Assert.Equal(expectedEraserDurability, pencil.CurrentEraserDurability); }
public void ShouldDoNothingIfNoMatchIsFound() { const string testSentence = "Not this or this"; const string eraseWord = "test"; IPencil pencil = GetPencil(); IPaper paper = GetPaper(testSentence); pencil.Erase(paper, eraseWord); Assert.Equal(testSentence, paper.Text); }
public void ShouldResetDurabilityToOriginalValue() { const string testSentence = "Text to waste pencil durability for testing sharpening abilities"; const int pointDurability = 100; IPencil pencil = GetPencil(pointDurability: pointDurability); pencil.Write(GetPaper(), testSentence); pencil.Sharpen(); Assert.Equal(pointDurability, pencil.CurrentPointDurability); }
public void ShouldWriteWhitespaceCharacters() { const string testWhitespace = " \t\r\n\f\v "; const int pointDurability = 0; IPencil pencil = GetPencil(pointDurability: pointDurability); IPaper paper = GetPaper(); pencil.Write(paper, testWhitespace); Assert.Equal(testWhitespace, paper.Text); }
public void ShouldDegradeByTwoWhenWritingInUppercase() { const string uppercaseLetter = "A"; const int startPointDurability = 5; const int expectedPointDurability = 3; IPencil pencil = GetPencil(pointDurability: startPointDurability); pencil.Write(GetPaper(), uppercaseLetter); Assert.Equal(expectedPointDurability, pencil.CurrentPointDurability); }
public void ShouldDoNothingWithNoDurability() { const string testSentence = " \v0?>9\n<8:6 (*4&\t^2# 1$% "; const int eraserDurability = 0; IPencil pencil = GetPencil(eraserDurability: eraserDurability); IPaper paper = GetPaper(testSentence); pencil.Erase(paper, testSentence); Assert.Equal(testSentence, paper.Text); }
public void ShouldDegradeCorrectlyForMixedCharactersAndWhitespace(string mixedString, int degradeAmount) { const int startEraserDurability = 50; int expectedEraserDurability = startEraserDurability - degradeAmount; IPencil pencil = GetPencil(eraserDurability: startEraserDurability); IPaper paper = GetPaper(mixedString); pencil.Erase(paper, mixedString); Assert.Equal(expectedEraserDurability, pencil.CurrentEraserDurability); }
public void ShouldDegradeCorrectlyForManyCharacters(string eraseMatch) { const int startEraserDurability = 50; int expectedEraserDurability = startEraserDurability - eraseMatch.Length; IPencil pencil = GetPencil(eraserDurability: startEraserDurability); IPaper paper = GetPaper(eraseMatch); pencil.Erase(paper, eraseMatch); Assert.Equal(expectedEraserDurability, pencil.CurrentEraserDurability); }
public void ShouldReplaceWhitespaceWithSpaces() { const string testWhitespace = " \t\r\n\f\v "; const string expected = " "; IPencil pencil = GetPencil(); IPaper paper = GetPaper(testWhitespace); pencil.Erase(paper, testWhitespace); Assert.Equal(expected, paper.Text); }
public void ShouldDegradeCorrectlyForManyUppercaseLetters(string uppercaseLetters) { const int uppercaseDegradeValue = 2; const int startPointDurability = 40; int expectedPointDurability = startPointDurability - (uppercaseLetters.Length * uppercaseDegradeValue); IPencil pencil = GetPencil(pointDurability: startPointDurability); pencil.Write(GetPaper(), uppercaseLetters); Assert.Equal(expectedPointDurability, pencil.CurrentPointDurability); }
public void ShouldDefaultDegradingByOneIfNotWhitespaceOrUppercase() { const string otherCharecter = "?"; const int startPointDurability = 5; const int expectedPointDurability = 4; IPencil pencil = GetPencil(pointDurability: startPointDurability); pencil.Write(GetPaper(), otherCharecter); Assert.Equal(expectedPointDurability, pencil.CurrentPointDurability); }
public void ShouldWriteCorrectNumberOfSpaces() { const string testSentence = "This should not be written."; const string expectedString = " "; const int pointDurability = 0; IPencil pencil = GetPencil(pointDurability: pointDurability); IPaper paper = GetPaper(); pencil.Write(paper, testSentence); Assert.Equal(expectedString, paper.Text); }
public void ShouldErasePartOfMatchingWord() { const string testWord = "word"; const string expectedWord = "wo "; const int eraserDurability = 2; IPencil pencil = GetPencil(eraserDurability: eraserDurability); IPaper paper = GetPaper(testWord); pencil.Erase(paper, testWord); Assert.Equal(expectedWord, paper.Text); }
public void ShouldMatchOnCaseWhenMatching() { const string paperText = "This but not this"; const string eraseWord = "This"; const string expectedSentence = " but not this"; IPencil pencil = GetPencil(); IPaper paper = GetPaper(paperText); pencil.Erase(paper, eraseWord); Assert.Equal(expectedSentence, paper.Text); }