Ejemplo n.º 1
0
        public async void CanRetrieveMoviesByName()
        {
            // Arrange - Create an instance of the OmdbService
            OmdbService target = new OmdbService();

            // Act - Request different results
            var resultPage1 = await target.GetByName("Jurassic");

            var resultPage2 = await target.GetByName("Jurassic", 2);

            var resultEmpty = await target.GetByName("a1z0b2y9c3x8d4w7e5v6");

            // Assert - Pages
            Assert.NotEmpty(resultPage1.Search);
            Assert.Equal(1, resultPage1.CurrentPage);

            Assert.NotEmpty(resultPage2.Search);
            Assert.Equal(2, resultPage2.CurrentPage);

            Assert.InRange(int.Parse(resultPage1.totalResults), 1, int.MaxValue);
            Assert.NotEqual(resultPage1.Search[0], resultPage2.Search[0]);
            Assert.Equal(resultPage1.totalResults, resultPage2.totalResults);

            // Assert - Empty
            Assert.Null(resultEmpty);
        }