예제 #1
0
        public void IfStringIsNullReturnNull()
        {
            string value  = null;
            var    result = subject.Reverse(value);

            Assert.IsNull(result);
        }
        [InlineData("eye", "eye")] // This is a palindrome!
        public void ShouldReverseWordSuccessfully(string input, string expected)
        {
            // Arrange | Act
            var result = Reverser.Reverse(input);

            // Assert
            Equal(expected, result);
        }
예제 #3
0
        public void Reverse_InvalidString_ReturnsNull()
        {
            //Arrange - initialize objects
            Reverser reverser = new Reverser();
            //Act
            var result = reverser.Reverse(null);

            //Assert
            Assert.AreEqual(null, result);
        }
예제 #4
0
        public void Reverse_ValidString_ReturnsReversedString()
        {
            //Arrange - initialize objects
            Reverser reverser = new Reverser();
            //Act
            var result = reverser.Reverse("abcdef");

            //Assert
            Assert.AreEqual("fedcba", result);
        }
예제 #5
0
        private static void Main(string[] args)
        {
            var reverser = new Reverser();

            while (true)
            {
                Console.Write("Enter a word to reverse: ");
                Console.WriteLine(reverser.Reverse(Console.ReadLine()));
            }
        }
예제 #6
0
        public void ShouldReverseWordToExpected(string input, string expected)
        {
            // Arrange
            var reverser = new Reverser(input);

            // Act
            var result = reverser.Reverse();

            // Assert
            AreEqual(expected, result);
        }
예제 #7
0
        public void Should_reverse_one_word()
        {
            string result = _reverser.Reverse("hello");

            Assert.AreEqual("olleh", result);
        }
예제 #8
0
 public void ReverseTest(string text,string expected)
 {
     var reverse = new Reverser();
     string result = reverse.Reverse(text);
     StringAssert.AreEqualIgnoringCase(result, expected);
 }
        //https://msdn.microsoft.com/en-us//library/bb383977.aspx
        public static string ReverseSentence(this string sentence)
        {
            var reverser = new Reverser();

            return(reverser.Reverse(sentence));
        }
예제 #10
0
 public ActionResult Test(string word)
 {
     return(Json(_reverser.Reverse(word)));
 }