public void GetUniqueListOfActorsFromTwoMovies() { var listOfMovies = new List <Movie> { new Movie { Roles = new HashSet <Role> { new Role { ActorName = "Eddie Murphy" } } }, new Movie { Roles = new HashSet <Role> { new Role { ActorName = "Eddie Murphy" } } } }; var movies = new MoviesContext(); movies.Initialise(listOfMovies); Assert.AreEqual(1, movies.Actors.Count); Assert.AreEqual("Eddie Murphy", movies.Actors[0]); }
public void GetRolesForActor() { var listOfMovies = new List <Movie> { new Movie { Roles = new HashSet <Role> { new Role { CharacterName = "Axel Foley", ActorName = "Eddie Murphy" } } }, new Movie { Roles = new HashSet <Role> { new Role { CharacterName = "Donkey", ActorName = "Eddie Murphy" } } } }; var movies = new MoviesContext(); movies.Initialise(listOfMovies); Assert.AreEqual(2, movies.RolesByActor("Eddie Murphy").Count); Assert.AreEqual("Axel Foley", movies.RolesByActor("Eddie Murphy").ToArray()[0].CharacterName); Assert.AreEqual("Donkey", movies.RolesByActor("Eddie Murphy").ToArray()[1].CharacterName); }
public void InitiliseMovies() { var role = new Role(); var movie = new Movie(); movie.Roles.Add(role); var listOfMovies = new List <Movie> { movie }; var movies = new MoviesContext(); movies.Initialise(listOfMovies); Assert.AreEqual(1, movies.AllMovies.Count); Assert.AreSame(movie, movies.AllMovies[0].Roles.First().Movie); }