예제 #1
0
 /// <summary>Determines whether the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Object" />.</summary>
 ///
 /// <param name="other">The rest movie to compare to this object.</param>
 ///
 /// <returns>true if the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Object" />; otherwise, false.</returns>
 public bool Equals(RestMovie other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.Id, Id) && Equals(other.Title, Title) && other.Rating == Rating && Equals(other.Director, Director) && other.ReleaseDate.Equals(ReleaseDate) && Equals(other.TagLine, TagLine) && Genres.EquivalentTo(other.Genres));
 }
예제 #2
0
        public void Can_add_movie()
        {
            var newMovie = new RestMovie
            {
                Id          = "tt0110912",
                Title       = "Pulp Fiction",
                Rating      = 8.9m,
                Director    = "Quentin Tarantino",
                ReleaseDate = new DateTime(1994, 10, 24),
                TagLine     = "Girls like me don't make invitations like this to just anyone!",
                Genres      = new List <string> {
                    "Crime", "Drama", "Thriller"
                },
            };

            SendToEachEndpoint <RestMoviesResponse>(new RestMovies {
                Movie = newMovie
            }, HttpMethods.Put, null);

            SendToEachEndpoint <RestMoviesResponse>(new RestMovies {
                Id = newMovie.Id
            }, HttpMethods.Get, response =>
                                                    Assert.That(newMovie.Equals(response.Movies[0]), Is.True)
                                                    );

            //Test if possible to get single movie
            var topMovie = ConfigureDatabase.Top5Movies[0];

            SendToEachEndpoint <RestMoviesResponse>(new RestMovies {
                Id = topMovie.Id
            }, HttpMethods.Get, response =>
                                                    Assert.That(topMovie.Equals(response.Movies[0]), Is.True)
                                                    );

            //Test if possible to update movie
            var topMovie2    = ConfigureDatabase.Top5Movies[0];
            var updatedMovie = TypeSerializer.Clone(topMovie2);

            updatedMovie.Title = "Updated Movie";

            SendToEachEndpoint <RestMoviesResponse>(new RestMovies {
                Movie = updatedMovie
            }, HttpMethods.Post, null);

            SendToEachEndpoint <RestMoviesResponse>(new RestMovies {
                Id = topMovie2.Id
            }, HttpMethods.Get, response =>
                                                    Assert.That(updatedMovie.Equals(response.Movies[0]), Is.True)
                                                    );
        }
예제 #3
0
		public void Can_add_movie()
		{
			var newMovie = new RestMovie
			{
				Id = "tt0110912",
				Title = "Pulp Fiction",
				Rating = 8.9m,
				Director = "Quentin Tarantino",
				ReleaseDate = new DateTime(1994, 10, 24),
				TagLine = "Girls like me don't make invitations like this to just anyone!",
				Genres = new List<string> { "Crime", "Drama", "Thriller" },
			};

			SendToEachEndpoint<RestMoviesResponse>(new RestMovies { Movie = newMovie }, HttpMethods.Put, null);

			SendToEachEndpoint<RestMoviesResponse>(new RestMovies { Id = newMovie.Id }, HttpMethods.Get, response =>
				Assert.That(newMovie.Equals(response.Movies[0]), Is.True)
			);

			//Test if possible to get single movie
			var topMovie = ConfigureDatabase.Top5Movies[0];
			SendToEachEndpoint<RestMoviesResponse>(new RestMovies { Id = topMovie.Id }, HttpMethods.Get, response =>
				Assert.That(topMovie.Equals(response.Movies[0]), Is.True)
			);

			//Test if possible to update movie
			var topMovie2 = ConfigureDatabase.Top5Movies[0];
			var updatedMovie = TypeSerializer.Clone(topMovie2);
			updatedMovie.Title = "Updated Movie";

			SendToEachEndpoint<RestMoviesResponse>(new RestMovies { Movie = updatedMovie }, HttpMethods.Post, null);

			SendToEachEndpoint<RestMoviesResponse>(new RestMovies { Id = topMovie2.Id }, HttpMethods.Get, response =>
				Assert.That(updatedMovie.Equals(response.Movies[0]), Is.True)
			);
		}
예제 #4
0
        /// <summary>Determines whether the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Object" />.</summary>
        ///
        /// <param name="other">The rest movie to compare to this object.</param>
        ///
        /// <returns>true if the specified <see cref="T:System.Object" /> is equal to the current <see cref="T:System.Object" />; otherwise, false.</returns>
		public bool Equals(RestMovie other)
		{
			if (ReferenceEquals(null, other)) return false;
			if (ReferenceEquals(this, other)) return true;
			return Equals(other.Id, Id) && Equals(other.Title, Title) && other.Rating == Rating && Equals(other.Director, Director) && other.ReleaseDate.Equals(ReleaseDate) && Equals(other.TagLine, TagLine) && Genres.EquivalentTo(other.Genres);
		}