コード例 #1
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)
                                                    );
        }
コード例 #2
0
 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));
 }
コード例 #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
        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)
            );
        }
コード例 #5
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)
			);
		}
コード例 #6
0
ファイル: RestMovie.cs プロジェクト: namman/ServiceStack
 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);
 }