예제 #1
0
        public void ShouldCreateQueryOk()
        {
            _builder.SetTitle(_title)
            .SetAuthor(_author)
            .SetPublisher(_publisher)
            .SetSubject(_subject)
            .SetVolumeId(_volumeId)
            .SetMaxResults(_maxResults)
            .SetProjection(_projection)
            .SetStartIndex(_startIndex)
            .SetPrintType(_printType)
            .SetOrderBy(_orderBy);

            var query = _builder.BuildQueryString();

            Assert.AreEqual(10, query.Split('&').Length);

            StringAssert.Contains($"{Parameters.Intitle}:{_title}", query);
            StringAssert.Contains($"{Parameters.Inauthor}:{_author}", query);
            StringAssert.Contains($"{Parameters.InPublisher}:{_publisher}", query);
            StringAssert.Contains($"{Parameters.Subject}:{_subject}", query);
            StringAssert.Contains($"{Parameters.VolumeId}:{_volumeId}", query);
            StringAssert.Contains($"{Parameters.MaxResults}={_maxResults}", query);
            StringAssert.Contains($"{Parameters.Projection}={_projection.Description()}", query);
            StringAssert.Contains($"{Parameters.StartIndex}={_startIndex}", query);
            StringAssert.Contains($"{Parameters.PrintType}={_printType.Description()}", query);
            StringAssert.Contains($"{Parameters.OrderBy}={_orderBy.Description()}", query);
        }