예제 #1
0
        public void TestMoviesGetMovieCasts()
        {
            Credits resp = Config.Client.GetMovieCreditsAsync(IdHelper.AGoodDayToDieHard).Result;

            Assert.NotNull(resp);

            Cast cast = resp.Cast.SingleOrDefault(s => s.Name == "Bruce Willis");

            Assert.NotNull(cast);

            Assert.Equal(1, cast.CastId);
            Assert.Equal("John McClane", cast.Character);
            Assert.Equal("52fe4751c3a36847f812f049", cast.CreditId);
            Assert.Equal(62, cast.Id);
            Assert.Equal("Bruce Willis", cast.Name);
            Assert.Equal(0, cast.Order);
            Assert.True(TestImagesHelpers.TestImagePath(cast.ProfilePath), "cast.ProfilePath was not a valid image path, was: " + cast.ProfilePath);

            Crew crew = resp.Crew.SingleOrDefault(s => s.Name == "Marco Beltrami");

            Assert.NotNull(crew);

            Assert.Equal("5336b0e09251417d9b000cc7", crew.CreditId);
            Assert.Equal("Sound", crew.Department);
            Assert.Equal(7229, crew.Id);
            Assert.Equal("Music", crew.Job);
            Assert.Equal("Marco Beltrami", crew.Name);
            Assert.True(TestImagesHelpers.TestImagePath(crew.ProfilePath), "crew.ProfilePath was not a valid image path, was: " + crew.ProfilePath);
        }
예제 #2
0
        public void TestMoviesGetMovieCasts()
        {
            Credits resp = _config.Client.GetMovieCredits(AGoodDayToDieHard).Result;

            Assert.IsNotNull(resp);

            Cast cast = resp.Cast.SingleOrDefault(s => s.Name == "Bruce Willis");

            Assert.IsNotNull(cast);

            Assert.AreEqual(1, cast.CastId);
            Assert.AreEqual("John McClane", cast.Character);
            Assert.AreEqual("52fe4751c3a36847f812f049", cast.CreditId);
            Assert.AreEqual(62, cast.Id);
            Assert.AreEqual("Bruce Willis", cast.Name);
            Assert.AreEqual(0, cast.Order);
            Assert.AreEqual("/kI1OluWhLJk3pnR19VjOfABpnTY.jpg", cast.ProfilePath);

            Crew crew = resp.Crew.SingleOrDefault(s => s.Name == "Marco Beltrami");

            Assert.IsNotNull(crew);

            Assert.AreEqual("5336b0e09251417d9b000cc7", crew.CreditId);
            Assert.AreEqual("Sound", crew.Department);
            Assert.AreEqual(7229, crew.Id);
            Assert.AreEqual("Music", crew.Job);
            Assert.AreEqual("Marco Beltrami", crew.Name);
            Assert.AreEqual("/tTBQHKWVieP5ARRfJRMkbnLTW6C.jpg", crew.ProfilePath);
        }
예제 #3
0
        public async void TestMoviesGetMovieCasts()
        {
            Credits resp = await TMDbClient.GetMovieCreditsAsync(IdHelper.AGoodDayToDieHard);

            Assert.NotNull(resp);

            Cast cast = resp.Cast.Single(s => s.CreditId == "52fe4751c3a36847f812f049");
            Crew crew = resp.Crew.Single(s => s.CreditId == "5336b04a9251417db4000c80");

            await Verify(new
            {
                cast,
                crew
            });

            TestImagesHelpers.TestImagePaths(resp.Cast.Select(s => s.ProfilePath).Where(s => s != null));
            TestImagesHelpers.TestImagePaths(resp.Crew.Select(s => s.ProfilePath).Where(s => s != null));
        }
예제 #4
0
        private static List<string> getStringFromCrewList(Credits credits)
        {
            List<string> credit = new List<string>();

            // Actors
            string cast = "";
            if (credits.Cast.Count > 0)
            {
                for (int i = 0; i < 4 && i<credits.Cast.Count; i++)
                {
                    cast = cast + credits.Cast[i].Name.ToString() + ", ";
                }
            }
            credit.Add(getSimpleString(cast));

            // Director
            string director = "";
            if (credits.Crew.Count > 0)
            {
                for (int i = 0; i < credits.Crew.Count; i++)
                {
                    if (credits.Crew[i].Job.Equals("Director"))
                    {
                        director = director + credits.Crew[i].Name.ToString() + ", ";
                    }
                }
            }
            credit.Add(getSimpleString(director));

            // Writer
            string writer = "";
            if (credits.Crew.Count > 0)
            {
                for (int i = 0; i < credits.Crew.Count; i++)
                {
                    if (credits.Crew[i].Department.Equals("Writing"))
                    {
                        writer = writer + credits.Crew[i].Name.ToString() + ", ";
                    }
                }
            }
            credit.Add(getSimpleString(writer));

            return credit;
        }