本文整理汇总了C#中Facade.GetMovieRepo方法的典型用法代码示例。如果您正苦于以下问题:C# Facade.GetMovieRepo方法的具体用法?C# Facade.GetMovieRepo怎么用?C# Facade.GetMovieRepo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facade
的用法示例。
在下文中一共展示了Facade.GetMovieRepo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Movie_add_will_create_new_genre_test
public void Movie_add_will_create_new_genre_test()
{
Facade facade = new Facade();
Movie temp = new Movie() { Genres = new List<Genre>() { new Genre() {Name = "test" } }, Name = "test", Price = 120d, TrailerURL = "test" };
temp = facade.GetMovieRepo().Add(temp);
Assert.AreEqual(facade.GetMovieRepo().Get(temp.Id).Genres.FirstOrDefault().Name, "test");
}
示例2: Movie_get_all_include_genres_test
public void Movie_get_all_include_genres_test()
{
Facade facade = new Facade();
Genre genre = new Genre() { Name = "test" };
List<Genre> list = new List<Genre>();
genre = facade.GetGenreRepo().Add(genre);
list.Add(genre);
Movie temp = new Movie() { Genres = list, Name = "test", Price = 120d, TrailerURL = "test" };
temp = facade.GetMovieRepo().Add(temp);
temp = facade.GetMovieRepo().Add(temp);
facade = new Facade();
Assert.IsNotNull(facade.GetMovieRepo().GetAll().ElementAt(0).Genres.FirstOrDefault());
Assert.IsNotNull(facade.GetMovieRepo().GetAll().ElementAt(1).Genres.FirstOrDefault());
}
示例3: OrderMovie_getall_oms_by_order_test
public void OrderMovie_getall_oms_by_order_test()
{
Facade facade = new Facade();
Movie mov = facade.GetMovieRepo().Add(SetMovie());
Movie mov2 = SetMovie();
mov2.Name = "changed";
mov2 = facade.GetMovieRepo().Add(mov2);
Order or1 = facade.GetOrderRepo().Add(SetOrder());
OrderMovie om = new OrderMovie() { Movie = mov, Order = or1 };
OrderMovie om2 = new OrderMovie() { Movie = mov2, Order = or1 };
om = facade.GetOrderMovieRepo().Add(om);
om2 = facade.GetOrderMovieRepo().Add(om2);
facade = new Facade();
Assert.GreaterOrEqual(facade.GetOrderMovieRepo().GetAllOrderMoviesByOrder(or1).ToList().Count, 2);
}
示例4: Movie_get_by_genre_return_empty_on_no_movies_test
public void Movie_get_by_genre_return_empty_on_no_movies_test()
{
Facade facade = new Facade();
Genre genre = new Genre() { Name = "test" };
genre = facade.GetGenreRepo().Add(genre);
facade = new Facade();
Assert.AreEqual(facade.GetMovieRepo().GetMovieByGenre(genre).ToList().Count, 0);
}
示例5: Movie_added_on_call_test
public void Movie_added_on_call_test()
{
Movie temp = new Movie() { Name = "test", Price = 120d, TrailerURL = "test" };
Facade facade = new Facade();
temp = facade.GetMovieRepo().Add(temp);
Context context = new Context();
Assert.IsNotNull(context.Movies.FirstOrDefault(x=>x.Id == temp.Id));
Assert.AreNotEqual(temp.Id, 0);
}
示例6: OrderMovie_get_movie_by_om_returning_movie_test
public void OrderMovie_get_movie_by_om_returning_movie_test()
{
Facade facade = new Facade();
Movie mov = facade.GetMovieRepo().Add(SetMovie());
Order or1 = facade.GetOrderRepo().Add(SetOrder());
OrderMovie om = new OrderMovie() { Movie = mov, Order = or1 };
om = facade.GetOrderMovieRepo().Add(om);
facade = new Facade();
Assert.AreEqual(facade.GetOrderMovieRepo().GetMovieByOrderMovie(om).Name, mov.Name);
}
示例7: OrderMovie_get_all_return_multiple_test
public void OrderMovie_get_all_return_multiple_test()
{
Facade facade = new Facade();
Movie mov = facade.GetMovieRepo().Add(SetMovie());
Order or1 = facade.GetOrderRepo().Add(SetOrder());
Order or2 = facade.GetOrderRepo().Add(SetOrder());
OrderMovie om = new OrderMovie() { Movie = mov, Order = or1 };
OrderMovie om2 = new OrderMovie() { Movie = mov, Order = or2 };
facade.GetOrderMovieRepo().Add(om);
facade.GetOrderMovieRepo().Add(om);
facade = new Facade();
Assert.GreaterOrEqual(facade.GetOrderMovieRepo().GetAll().ToList().Count, 2);
}
示例8: Genre_getgenrebymovie_return_multiple_test
public void Genre_getgenrebymovie_return_multiple_test()
{
Facade facade = new Facade();
Genre genre = new Genre() { Name = "test1" };
Genre genretwo = new Genre() { Name = "test2" };
List<Genre> list = new List<Genre>();
//genre = facade.GetGenreRepo().Add(genre);
//genretwo = facade.GetGenreRepo().Add(genretwo);
list.Add(genre);
list.Add(genretwo);
Movie temp = new Movie() { Genres = list, Name = "test", Price = 120d, TrailerURL = "test" };
temp = facade.GetMovieRepo().Add(temp);
Assert.GreaterOrEqual(facade.GetGenreRepo().GetGenreByMovie(temp).ToList().Count, 2);
}
示例9: Order_added_on_create_test
public void Order_added_on_create_test()
{
Facade facade = new Facade();
Customer cus = new Customer()
{
FirstName = "Test",
Address = "TestAddress",
BirthDate = DateTime.Now,
Email = "TestEmail",
PhoneNumber = 1234
};
cus = facade.GetCustomerRepo().Add(cus);
Genre genre = new Genre() { Name = "TestGenre" };
List<Genre> list = new List<Genre>();
genre = facade.GetGenreRepo().Add(genre);
list.Add(genre);
Movie movie = new Movie()
{
Name = "TestName",
Genres = list,
Price = 123,
TrailerURL = "TestURL"
};
movie = facade.GetMovieRepo().Add(movie);
Order order = new Order()
{
Customer = cus,
Date = DateTime.Now
};
OrderMovie om = new OrderMovie() { Movie = movie, Order = order };
om = facade.GetOrderMovieRepo().Add(om);
order.OrderMovie.Add(om);
order = facade.GetOrderRepo().Add(order);
facade = new Facade();
Assert.AreEqual(order.Customer.FirstName, facade.GetOrderRepo().Get(order.Id).Customer.FirstName);
}
示例10: Movie_add_throws_expection_on_movie_name_equals_null_test
public void Movie_add_throws_expection_on_movie_name_equals_null_test()
{
Facade facade = new Facade();
Movie movie = new Movie();
facade.GetMovieRepo().Add(movie);
}
示例11: Movie_get_movie_by_genre_working_test
public void Movie_get_movie_by_genre_working_test()
{
Facade facade = new Facade();
Movie temp = new Movie() { Name = "test", Price = 120d, TrailerURL = "test" };
Movie temp2 = new Movie() {Name = "test2", Price = 120d, TrailerURL = "test" };
temp = facade.GetMovieRepo().Add(temp);
temp2 = facade.GetMovieRepo().Add(temp2);
List<Movie> movies = new List<Movie>() { temp, temp2 };
Genre genre = new Genre() { Name = "test", Movies = movies };
genre = facade.GetGenreRepo().Add(genre);
facade = new Facade();
Assert.AreEqual(2, facade.GetMovieRepo().GetMovieByGenre(genre).ToList().Count);
}
示例12: OrderMovie_update_updates_in_db_test
public void OrderMovie_update_updates_in_db_test()
{
Facade facade = new Facade();
Movie mov = facade.GetMovieRepo().Add(SetMovie());
Movie mov2 = SetMovie();
mov2.Name = "changed";
mov2 = facade.GetMovieRepo().Add(mov2);
Order or1 = facade.GetOrderRepo().Add(SetOrder());
OrderMovie om = new OrderMovie() { Movie = mov, Order = or1 };
om = facade.GetOrderMovieRepo().Add(om);
facade = new Facade();
om.Movie = mov2;
Assert.IsTrue(facade.GetOrderMovieRepo().Update(om));
facade = new Facade();
Assert.AreEqual(mov2.Name, facade.GetOrderMovieRepo().Get(om.Id).Movie.Name);
}
示例13: Movie_get_by_id_includes_genres_test
public void Movie_get_by_id_includes_genres_test()
{
Facade facade = new Facade();
Genre genre = new Genre() { Name = "test" };
List<Genre> list = new List<Genre>();
genre = facade.GetGenreRepo().Add(genre);
list.Add(genre);
Movie temp = new Movie() { Genres = list, Name = "test", Price = 120d, TrailerURL = "test" };
temp = facade.GetMovieRepo().Add(temp);
facade = new Facade();
Assert.AreEqual(genre.Name, facade.GetMovieRepo().Get(temp.Id).Genres.FirstOrDefault().Name);
Assert.AreEqual(genre.Id, facade.GetMovieRepo().Get(temp.Id).Genres.FirstOrDefault().Id);
}
示例14: Movie_remove_removing_from_database_test
public void Movie_remove_removing_from_database_test()
{
Movie temp = new Movie() { Name = "test", Price = 120d, TrailerURL = "test" };
Facade facade = new Facade();
temp = facade.GetMovieRepo().Add(temp);
facade = new Facade();
facade.GetMovieRepo().Remove(temp.Id);
facade = new Facade();
Assert.IsNull(facade.GetMovieRepo().Get(temp.Id));
}
示例15: Movie_get_returns_null_on_not_valid_id_test
public void Movie_get_returns_null_on_not_valid_id_test()
{
Facade facade = new Facade();
Assert.IsNull(facade.GetMovieRepo().Get(-1));
}