コード例 #1
0
        public void Test_SearchIdLookupRequest_Validate_Throws_ArgumentException()
        {
            // id type is unspecified
            var request = new SearchIdLookupRequest {
                LookupId = "lookupId", IdType = TraktSearchIdType.Unspecified
            };

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

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

            // lookup id is empty
            request = new SearchIdLookupRequest {
                LookupId = string.Empty, IdType = TraktSearchIdType.Trakt
            };

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

            // lookup id contains spaces
            request = new SearchIdLookupRequest {
                LookupId = "lookup id", IdType = TraktSearchIdType.Trakt
            };

            act = () => request.Validate();
            act.Should().Throw <ArgumentException>();
        }
コード例 #2
0
        public void Test_SearchIdLookupRequest_Validate_Throws_ArgumentNullException()
        {
            // no id type set
            var request = new SearchIdLookupRequest {
                LookupId = "lookupId"
            };

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

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

            // no lookup id set
            request = new SearchIdLookupRequest {
                IdType = TraktSearchIdType.Trakt
            };

            act = () => request.Validate();
            act.Should().Throw <ArgumentNullException>();
        }
コード例 #3
0
        public void Test_SearchIdLookupRequest_Has_Valid_UriTemplate()
        {
            var request = new SearchIdLookupRequest();

            request.UriTemplate.Should().Be("search/{id_type}/{id}{?type,extended,page,limit}");
        }
コード例 #4
0
        public void Test_SearchIdLookupRequest_Has_AuthorizationRequirement_NotRequired()
        {
            var request = new SearchIdLookupRequest();

            request.AuthorizationRequirement.Should().Be(AuthorizationRequirement.NotRequired);
        }