Exemple #1
0
        public void TopQuotesShouldReturnExpectedView()
        {
            Expect.Call(quotesDao.GetAllQuotes()).Return(quotes.AsQueryable <Quote>());
            mocks.ReplayAll();

            QuoteController quoteController = new QuoteController(quotesDao);
            ViewResult      result          = quoteController.TopQuotes() as ViewResult;

            Assert.IsNotNull(result);
            Assert.AreEqual("TopQuotes", result.ViewName);
        }
Exemple #2
0
        public void TopQuotesShouldReturnExpectedViewData()
        {
            Expect.Call(quotesDao.GetAllQuotes()).Return(quotes.AsQueryable <Quote>());
            mocks.ReplayAll();

            QuoteController        quoteController = new QuoteController(quotesDao);
            ViewResult             result          = quoteController.TopQuotes() as ViewResult;
            PaginatedTopQuotesList actual          = result.ViewData.Model as PaginatedTopQuotesList;

            Assert.IsNotNull(actual);
            Assert.AreEqual(quoteController.pageSize, actual.Count());
        }
Exemple #3
0
        public void TestTopQuotes()
        {
            var controllerQuote = new QuoteController();

            var resultQuote  = controllerQuote.TopQuotes(0)  as ViewResult;
            var produktQuote = (List <TopQuotesViewModel>)resultQuote.ViewData.Model;


            // Folgende Quotes sind bereits in der Datenbank gespeichert. Die Reihenfolge:

            // insert into MediaLib.dbo.QuoteSet (QuoteString, Character, Language, Invocations, UserId, MediaId)
            // values ('TIMAH.', 'Timmy', 'English', 10, 1, 6);
            // values ('Honey! C''mon over here, Sugar-buns. This machine just called me an asshole!', 'Man At Cashpoint', 'English', 9, 1, 4);
            // values ('Reese. Why me? Why does it want me?', 'Sarah Connor', 'English', 8, 1, 1);
            // values ('You son of a bitch!', 'Lily Aldrin', 'English', 7, 1, 8);
            // values ('Moist', 'Barney Stinson', 'English', 6, 1, 8);
            // values ('Your clothes... give them to me, now.', 'The Terminator', 'English', 6, 1, 1);
            // values ('I don''t know half of you half as well as I should like; and I like less than half of you half as well as you deserve.', 'Bilbo Baggins', 'English', 6, 1, 10);
            // values ('Heeere''s Johnny!', 'Jack Torrance', 'English', 5, 1, 5 );
            // values ('How do you kill, that which has no life? ', 'Blizzard Employee', 'English', 5, 1, 6);
            // values ('Drugs are bad, mkay ...', 'Mr. Mackey', 'English', 4, 1, 6);

            ArrayList gesuchteTopQuotes = new ArrayList();

            gesuchteTopQuotes.Add("TIMAH.");
            gesuchteTopQuotes.Add("Honey! C'mon over here, Sugar-buns. This machine just called me an asshole!");
            gesuchteTopQuotes.Add("Reese. Why me? Why does it want me?");
            gesuchteTopQuotes.Add("You son of a bitch!");
            gesuchteTopQuotes.Add("I don't know half of you half as well as I should like; and I like less than half of you half as well as you deserve.");

            for (int i = 0; i <= gesuchteTopQuotes.Count - 1; i++)
            {
                Assert.AreEqual(gesuchteTopQuotes[i], produktQuote.ElementAt <TopQuotesViewModel>(i).Quote.QuoteString);
            }

            Assert.AreEqual(10, produktQuote.Count);
        }