public void ThenTheResponseShouldNotContainALink(string linkRel)
        {
            SwaggerResponse response = this.scenarioContext.GetLastApiResponse();
            Resource        resource = response.ResultAs <Resource>();

            Assert.IsFalse(resource._links.TryGetValue(linkRel, out _));
        }
        public void ThenTheResponseShouldContainAnEmbeddedResourceCalled(string linkRel)
        {
            SwaggerResponse response = this.scenarioContext.GetLastApiResponse();
            Resource        resource = response.ResultAs <Resource>();

            resource._embedded.TryGetValue(linkRel, out ResourceEmbeddedResource embeddedResource);

            Assert.IsNotNull(embeddedResource, $"Expected the response to contain an embedded resource called '{linkRel}' but none was found");
        }
        public void ThenTheResponseShouldContainALink(string linkRel)
        {
            SwaggerResponse response = this.scenarioContext.GetLastApiResponse();
            Resource        resource = response.ResultAs <Resource>();

            resource._links.TryGetValue(linkRel, out ResourceLink link);

            Assert.IsNotNull(link, $"Expected the response to contain a link relation called '{linkRel}' but none was found");
        }
        public void ThenTheEmbeddedResourceCalledShouldMatchTheContentCalled(string linkRel, string expectedKey)
        {
            SwaggerResponse response = this.scenarioContext.GetLastApiResponse();
            Resource        resource = response.ResultAs <Resource>();

            ContentResponse actual = resource.GetEmbeddedDocument <ContentResponse>(linkRel);

            Cms.Content expected = this.scenarioContext.Get <Cms.Content>(expectedKey);

            ContentSpecHelpers.Compare(expected, actual);
        }
        public void ThenTheLocationHeaderShouldMatchTheResponseLink(string linkRel)
        {
            SwaggerResponse response       = this.scenarioContext.GetLastApiResponse();
            string          locationHeader = response.Headers["Location"]?.First();

            Resource     resource = response.ResultAs <Resource>();
            ResourceLink link     = resource._links[linkRel];

            Assert.IsNotNull(link);

            string selfLinkUrl = (string)link.AdditionalProperties["href"];

            Assert.AreEqual(locationHeader, selfLinkUrl);
        }