Beispiel #1
0
        public void Test_ShowNextEpisodeRequest_Returns_Valid_UriPathParameters()
        {
            // without extended info
            var request = new ShowNextEpisodeRequest {
                Id = "123"
            };

            request.GetUriPathParameters().Should().NotBeNull()
            .And.HaveCount(1)
            .And.Contain(new Dictionary <string, object>
            {
                ["id"] = "123"
            });

            // with extended info
            var extendedInfo = new TraktExtendedInfo {
                Full = true
            };

            request = new ShowNextEpisodeRequest {
                Id = "123", ExtendedInfo = extendedInfo
            };

            request.GetUriPathParameters().Should().NotBeNull()
            .And.HaveCount(2)
            .And.Contain(new Dictionary <string, object>
            {
                ["id"]       = "123",
                ["extended"] = extendedInfo.ToString()
            });
        }
Beispiel #2
0
        public void Test_ShowNextEpisodeRequest_Validate_Throws_Exceptions()
        {
            // id is null
            var request = new ShowNextEpisodeRequest();

            Action act = () => request.Validate();

            act.Should().Throw <ArgumentNullException>();

            // empty id
            request = new ShowNextEpisodeRequest {
                Id = string.Empty
            };

            act = () => request.Validate();
            act.Should().Throw <ArgumentException>();

            // id with spaces
            request = new ShowNextEpisodeRequest {
                Id = "invalid id"
            };
            act.Should().Throw <ArgumentException>();
        }
Beispiel #3
0
        public void Test_ShowNextEpisodeRequest_Has_Valid_UriTemplate()
        {
            var request = new ShowNextEpisodeRequest();

            request.UriTemplate.Should().Be("shows/{id}/next_episode{?extended}");
        }