Created
July 2, 2021 11:49
-
-
Save berkdulger/b6e4645e426bf5099cadb246d8e2f367 to your computer and use it in GitHub Desktop.
Reverse String - C# Kata
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace ReverseString.Tests | |
{ | |
[TestClass] | |
public class ReverseStringTests | |
{ | |
private ReverseString reverseString; | |
[TestInitialize] | |
public void TestInitialize() | |
{ | |
reverseString = new ReverseString(); | |
} | |
[TestCleanup] | |
public void TestCleanup() | |
{ | |
reverseString = null; | |
} | |
[TestMethod] | |
public void ReverseString_HelloWorld() | |
{ | |
string result = reverseString.Reverse("Hello, World!"); | |
Assert.AreEqual("!dlroW ,olleH", result); | |
} | |
[TestMethod] | |
public void ReverseString_called_twice_returns_original_value() | |
{ | |
const string expected = "Hello, World!"; | |
string result = reverseString.Reverse(reverseString.Reverse(expected)); | |
Assert.AreEqual(expected, result); | |
} | |
[TestMethod] | |
public void ReverseString_returns_empty_string_for_input_of_empty_string() | |
{ | |
string result = reverseString.Reverse(String.Empty); | |
Assert.AreEqual(String.Empty, result); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment