Ejemplo n.º 1
0
        public void TestMoviesAccountStateRatingSet()
        {
            _config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
            MovieAccountState accountState = _config.Client.GetMovieAccountState(Avatar);

            // For this test to pass the movie Avatar need to be rated, added to the favorite list and watchlist
            Assert.AreEqual(Avatar, accountState.Id);
            Assert.IsNotNull(accountState.Rating);
            Assert.IsTrue(accountState.Favorite, "Please add Avatar to the users favourites list");
            Assert.IsTrue(accountState.Watchlist, "Please add Avatar to the users watchlist");
        }
Ejemplo n.º 2
0
        public void TestMoviesAccountStateRatingNotSet()
        {
            _config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
            MovieAccountState accountState = _config.Client.GetMovieAccountState(AGoodDayToDieHard);

            // For this test to pass the movie A Good Day To Die Hard need to be NOT rated, and REMOVED from the favorite list and watchlist
            Assert.AreEqual(AGoodDayToDieHard, accountState.Id);
            Assert.IsNull(accountState.Rating);
            Assert.IsFalse(accountState.Favorite, "Please remove A Good Day To Die Hard from the users favourites list");
            Assert.IsFalse(accountState.Watchlist, "Please remove A Good Day To Die Hard from the users watchlist");
        }
Ejemplo n.º 3
0
        private static void DeserializeAccountStatesRating(MovieAccountState accountState, string responseContent)
        {
            const string selector = @"""rated"":{""value"":(?<value>\d+(?:\.\d{1,2}))}";
            Regex        regex    = new Regex(selector, RegexOptions.IgnoreCase);
            Match        match    = regex.Match(responseContent);

            if (match.Success)
            {
                accountState.Rating = Double.Parse(match.Groups["value"].Value,
                                                   CultureInfo.InvariantCulture.NumberFormat);
            }
        }
Ejemplo n.º 4
0
        public void TestMoviesAccountStateRatingNotSet()
        {
            _config.Client.SetSessionInformation(_config.UserSessionId, SessionType.UserSession);
            MovieAccountState accountState = _config.Client.GetMovieAccountState(AGoodDayToDieHard);

            _config.Client.SetSessionInformation(null, SessionType.Unassigned);

            // For this test to pass the movie avatar need to be rated, added to the favorite list and watchlist
            Assert.AreEqual(AGoodDayToDieHard, accountState.Id);
            Assert.IsNull(accountState.Rating);
            Assert.IsTrue(accountState.Favorite);
            Assert.IsTrue(accountState.Watchlist);
        }