Esempio n. 1
0
        public void GetTags_ReturnsLimitedTags_WhenLimitSpecified()
        {
            var tagResponse = auth.GetTags(new TagQueryParams {
                Limit = 4, Fields = TagFields.Id
            });

            Assert.AreEqual(4, tagResponse.Tags.Count);
        }
Esempio n. 2
0
        public void GetTags_ReturnsNull_WhenKeyIsInvalid_AndGhostExceptionsSuppressed(ExceptionLevel exceptionLevel)
        {
            auth = new GhostContentAPI(Host, InvalidApiKey)
            {
                ExceptionLevel = exceptionLevel
            };

            auth.ExceptionLevel = exceptionLevel;

            Assert.IsNull(auth.GetTags());
            Assert.IsNotNull(auth.LastException);
        }
Esempio n. 3
0
        public void GetTags_ThrowsException_WhenKeyIsInvalid(ExceptionLevel exceptionLevel)
        {
            auth = new GhostContentAPI(Host, InvalidApiKey)
            {
                ExceptionLevel = exceptionLevel
            };

            var ex = Assert.Throws <GhostSharpException>(() => auth.GetTags());

            Assert.IsNotEmpty(ex.Errors);
            Assert.AreEqual("Unknown Content API Key", ex.Errors[0].Message);
        }
Esempio n. 4
0
        public void GetTags_ReturnsMatchingPosts()
        {
            SetupMockTag();

            var response = auth.GetTags().Tags[0];

            Assert.AreEqual(id, response.Id);
            Assert.AreEqual(name, response.Name);
            Assert.AreEqual(slug, response.Slug);
        }