Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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()));
            }
        }
Exemplo n.º 6
0
        public void ShouldReverseWordToExpected(string input, string expected)
        {
            // Arrange
            var reverser = new Reverser(input);

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

            // Assert
            AreEqual(expected, result);
        }
Exemplo n.º 7
0
        public void Should_reverse_one_word()
        {
            string result = _reverser.Reverse("hello");

            Assert.AreEqual("olleh", result);
        }
Exemplo n.º 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));
        }
Exemplo n.º 10
0
 public ActionResult Test(string word)
 {
     return(Json(_reverser.Reverse(word)));
 }