Exemple #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)
                                                    );

            //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)
                                                    );
        }
Exemple #2
0
        public void Can_update_movie()
        {
            var topMovie     = ConfigureDatabase.Top5Movies[0];
            var updatedMovie = TypeSerializer.Clone(topMovie);

            updatedMovie.Title = "Updated Movie";

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

            SendToEachEndpoint <MoviesResponse>(new Movies {
                Id = topMovie.Id
            }, HttpMethods.Get, response =>
                                                Assert.That(updatedMovie.Equals(response.Movies[0]), Is.True)
                                                );
        }
        public void Can_update_movie()
        {
            var topMovie     = ConfigureDatabase.Top5Movies[0];
            var updatedMovie = TypeSerializer.Clone(topMovie);

            updatedMovie.Title = "Updated Movie";

            base.Send <MoviesResponse>(new Movies {
                Movie = updatedMovie
            },
                                       EndpointAttributes.HttpPost);

            var response = base.Send <MoviesResponse>(new Movies {
                Id = topMovie.Id
            });

            Assert.That(updatedMovie.Equals(response.Movies[0]), Is.True);
        }