public void TestAddQuoteToMovie() { AddMovies(1); MediaLibContainer context = ContextHelper <MediaLibContainer> .GetCurrentContext(); Movie movie = context.MediaSet.OfType <Movie>().First <Movie>(); int expectedMovieId = movie.Id; QuoteController quoteController = new QuoteController(); FormCollection collection = new FormCollection(); collection["Language"] = QuoteLanguageEnum.Deutsch.ToString(); collection["Character"] = "Rolle"; collection["Wann"] = "01:11:15"; collection["QuoteString"] = "QuoteStringMovie"; ViewResult result = quoteController.AddQuote(movie.Id, collection, fakeUser) as ViewResult; Movie movies = MediaService.Instance.GetMovieById(movie.Id); Assert.IsNotNull(movies); Assert.AreEqual(collection["Language"], movies.Quote.Single <Quote>().Language); Assert.AreEqual(collection["Character"], movies.Quote.Single <Quote>().Character); Assert.AreEqual(collection["Wann"], movies.Quote.Single <Quote>().OccurenceTime); Assert.AreEqual(collection["QuoteString"], movies.Quote.Single <Quote>().QuoteString); Assert.AreEqual("AddQuoteMessage", result.ViewName); }
public void TestAddQuoteToBook() { AddBooks(1); MediaLibContainer context = ContextHelper <MediaLibContainer> .GetCurrentContext(); Book book = context.MediaSet.OfType <Book>().First <Book>(); int expectedBookId = book.Id; QuoteController quoteController = new QuoteController(); FormCollection collection = new FormCollection(); collection["Language"] = QuoteLanguageEnum.Deutsch.ToString(); collection["Character"] = "Rolle"; collection["QuoteString"] = "QuoteStringBook"; ViewResult result = quoteController.AddQuote(book.Id, collection, fakeUser) as ViewResult; Book books = MediaService.Instance.GetBookById(book.Id); Assert.IsNotNull(books); Assert.AreEqual(collection["Language"], books.Quote.Single <Quote>().Language); Assert.AreEqual(collection["Character"], books.Quote.Single <Quote>().Character); Assert.AreEqual(collection["QuoteString"], books.Quote.Single <Quote>().QuoteString); Assert.AreEqual("AddQuoteMessage", result.ViewName); }