Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo 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);
        }