Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.04 KB | None | 0 0
  1. [TestMethod]
  2. public void IsPalindrome_ForPalindromeString_ReturnsTrue()
  3. {
  4.     // In the Arrange phase, we create and set up a system under test.
  5.     // A system under test could be a method, a single object, or a graph of connected objects.
  6.     // It is OK to have an empty Arrange phase, for example if we are testing a static method -
  7.     // in this case SUT already exists in a static form and we don't have to initialize anything explicitly.
  8.     PalindromeDetector detector = new PalindromeDetector();
  9.  
  10.     // The Act phase is where we poke the system under test, usually by invoking a method.
  11.     // If this method returns something back to us, we want to collect the result to ensure it was correct.
  12.     // Or, if method doesn't return anything, we want to check whether it produced the expected side effects.
  13.     bool isPalindrome = detector.IsPalindrome("kayak");
  14.  
  15.     // The Assert phase makes our unit test pass or fail.
  16.     // Here we check that the method's behavior is consistent with expectations.
  17.     Assert.IsTrue(isPalindrome);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement