public void PutMovieServiceTest() { Service.MovieService movieService = new Service.MovieService(new MovieDataProvider()); var movieData = movieService.Post(new Dto.MovieDto() { Title = "Test Title", Cast = new[] { "Test Cast1", "Test Cast 2" }, Classification = "Test Classification", Genre = "Test Genre", Rating = 5, ReleaseDate = (int)DateTime.Now.Ticks }); Assert.AreNotEqual(0, movieData.ID); var searchQuery = new Dto.MovieQuery(); searchQuery.SearchCriteria.ID = movieData.ID; var searchResult = movieService.Get(searchQuery); Assert.IsNotNull(searchResult); Assert.AreNotEqual(0, searchResult.records); movieData.Title = "Test Title Changed"; var result = movieService.Put(movieData.ID ?? 0, movieData); Assert.IsTrue(result); searchResult = movieService.Get(searchQuery); Assert.IsNotNull(searchResult); Assert.AreNotEqual(0, searchResult.records); List <MovieDto> data = new List <MovieDto>(searchResult.rows); Assert.AreEqual("Test Title Changed", data[0].Title, true); }
public void PostMovieServiceTest() { Service.MovieService movieService = new Service.MovieService(new MovieDataProvider()); var movieData = movieService.Post(new Dto.MovieDto() { Title = "Test Title", Cast = new[] { "Test Cast1", "Test Cast 2" }, Classification = "Test Classification", Genre = "Test Genre", Rating = 5, ReleaseDate = (int)DateTime.Now.Ticks }); Assert.AreNotEqual(0, movieData.ID); }