Esempio n. 1
0
        public void Test1()
        {
            var    generator = new SimpleRandomQuoteProvider();
            long   input     = 0;
            string expected  = "Quote number: 0 The quote: Fear of a name only increases fear of the thing itself. Author: Hermione Granger ";
            var    actual    = generator.getQuoteByID(input);

            Assert.AreEqual(expected, actual);

            input    = 1;
            expected = "Quote number: 1 The quote: It is our choices, Harry, that show what we truly are, far more than our abilities. Author: Albus Dumbledore ";
            actual   = generator.getQuoteByID(input);
            Assert.AreEqual(expected, actual);

            input    = 2;
            expected = "Quote number: 2 The quote: I solemnly swear I am up to no good. Author: Harry Potter ";
            actual   = generator.getQuoteByID(input);
            Assert.AreEqual(expected, actual);

            input    = -1;
            expected = "There is not a quote at this index";
            actual   = generator.getQuoteByID(input);
            Assert.AreEqual(expected, actual);

            input    = 3;
            expected = "There is not a quote at this index";
            actual   = generator.getQuoteByID(input);
            Assert.AreEqual(expected, actual);

            //Assert.Pass();
        }
Esempio n. 2
0
        public void getQuoteByIDTest()
        {
            SimpleRandomQuoteProvider simp     = new SimpleRandomQuoteProvider();
            List <string>             expected = new List <string>();
            string input = "0";

            expected.Add("0");
            expected.Add("endure and survive");
            expected.Add("-Ellie, Last of Us");

            IEnumerable <string> actual = simp.getQuoteByID(input);

            Assert.AreEqual(expected, actual);
        }
Esempio n. 3
0
 public ActionResult <IEnumerable <string> > Get(int id)
 {
     return(simp.getQuoteByID(id.ToString()).ToList());
 }