Exemple #1
0
        public void TestOhceReverse()
        {
            Ohce     _ohce   = new Ohce();
            DateTime time    = DateTime.ParseExact("20170201220000", "yyyyMMddHHmmss", CultureInfo.InvariantCulture);
            string   message = _ohce.AnalizeInput("hola", time);

            Assert.Equal("aloh", message);
        }
Exemple #2
0
        public void TestOhcePalindrome()
        {
            Ohce     _ohce   = new Ohce();
            DateTime time    = DateTime.ParseExact("20170201220000", "yyyyMMddHHmmss", CultureInfo.InvariantCulture);
            string   message = _ohce.AnalizeInput("ana", time);

            Assert.Equal("¡Bonita palabra!", message);
        }
Exemple #3
0
        public void TestOhceNight()
        {
            Ohce     _ohce   = new Ohce();
            DateTime time    = DateTime.ParseExact("20170201220000", "yyyyMMddHHmmss", CultureInfo.InvariantCulture);
            string   message = _ohce.AnalizeInput("ohce Paco", time);

            Assert.Equal("¡Buenas noches Paco!", message);
        }
Exemple #4
0
        public void TestOhceBye()
        {
            Ohce     _ohce   = new Ohce();
            DateTime time    = DateTime.ParseExact("20170201220000", "yyyyMMddHHmmss", CultureInfo.InvariantCulture);
            string   aux     = _ohce.AnalizeInput("ohce Paco", time);
            string   message = _ohce.AnalizeInput("Stop!", time);

            Assert.Equal("Adios Paco", message);
        }
Exemple #5
0
        public void When_write_line_is_called_writes_to_console_the_result_of_reverser()
        {
            var  application = new Mock <IApplication>();
            var  greeter     = CreateGreeter("Pedro", "Hello Pedro", "Bye Pedro");
            var  reverser    = CreateReverser("loc", "col");
            Ohce tested      = new Ohce("Pedro", application.Object, greeter, reverser);

            tested.WriteLine("loc");

            application.Verify(a => a.WriteToConsole("col"), Times.Once);
        }
Exemple #6
0
        public void When_input_of_write_line_is_Stop_then_it_writes_to_console_the_result_of_greeter_say_bye_and_exits_application_in_this_order()
        {
            var  application = new Mock <IApplication>();
            var  greeter     = CreateGreeter("Pedro", "Hello Pedro", "Bye Pedro");
            var  reverser    = CreateReverser("loc", "col");
            Ohce tested      = new Ohce("Pedro", application.Object, greeter, reverser);

            tested.WriteLine("Stop!");

            application.Verify(a => a.WriteToConsole("Bye Pedro"), Times.Once);
            application.Verify(a => a.Exit(), Times.Once);
        }
Exemple #7
0
        public void When_input_of_write_line_is_not_a_palindrome_then_it_writes_to_console_the_result_of_reverser_but_is_does_not_add_bonita_palabra()
        {
            var  application = new Mock <IApplication>();
            var  greeter     = CreateGreeter("Pedro", "Hello Pedro", "Bye Pedro");
            var  reverser    = CreateReverser("No soy palindromo", "No soy palindromo al revés");
            Ohce tested      = new Ohce("Pedro", application.Object, greeter, reverser);

            tested.WriteLine("No soy palindromo");

            application.Verify(a => a.WriteToConsole("No soy palindromo al revés"), Times.Once);
            application.Verify(a => a.WriteToConsole("¡Bonita palabra!"), Times.Never);
        }
Exemple #8
0
        public void When_input_of_write_line_is_a_palindrome_then_it_writes_to_console_the_result_of_reverser_and_adds_bonita_palabra()
        {
            string palindrome  = "Adivina ya te opina ya ni miles origina ya ni cetro me domina ya ni monarcas a repaso ni mulato carreta acaso nicotina ya ni cita vecino anima cocin, pedazo gallina cedazo terso nos retoza de canilla goza de pánico camina ónice vaticina ya ni tocino saca a terracota luminosa pera sacra nómina y ánimo de mortecina ya ni giros elimina ya ni poeta ya ni vida";
            var    application = new Mock <IApplication>();
            var    greeter     = CreateGreeter("Pedro", "Hello Pedro", "Bye Pedro");
            var    reverser    = CreateReverser(palindrome, palindrome);
            Ohce   tested      = new Ohce("Pedro", application.Object, greeter, reverser);

            tested.WriteLine(palindrome);

            application.Verify(a => a.WriteToConsole(palindrome), Times.Once);
            application.Verify(a => a.WriteToConsole("¡Bonita palabra!"), Times.Once);
        }