Exemple #1
0
        public void CanFollowAllAuthorsAndGetAllEMails()
        {
            // Arrange
            HashSet <string> foundEMails = new HashSet <string>();
            Request          blogRequest = Session.Bind(BlogRootPath);

            // Act ...

            // - GET blog
            Resources.Blog blog = blogRequest.Get <Resources.Blog>().Body;

            foreach (Resources.Blog.Post post in blog.Posts)
            {
                // - GET post
                Resources.Post fullPost = post.Links.Select("self").Follow(Session).Get <Resources.Post>().Body;

                // - Follow author link
                Resources.Author author = fullPost.Links.Select("author").Follow(Session).Get <Resources.Author>().Body;

                // - Register e-mail
                foundEMails.Add(author.EMail);
            }

            // Assert ...
            Assert.AreEqual(2, foundEMails.Count);
            Assert.IsTrue(foundEMails.Contains("*****@*****.**"));
            Assert.IsTrue(foundEMails.Contains("*****@*****.**"));
        }
Exemple #2
0
        public void CanFollowAuthorLinkFromBlog()
        {
            // Arrange
            Request blogRequest = Session.Bind(BlogRootPath);

            // Act ...

            // - GET blog
            Resources.Blog blog = blogRequest.Get <Resources.Blog>().Body;

            // - Fetch author link
            ILink authorLink = blog.Links.Select("author");

            // - Follow author link and get author data
            Resources.Author author = authorLink.Follow(Session).Get <Resources.Author>().Body;

            // Assert ...
            Assert.IsNotNull(author);

            // - Check e-mail of author
            Assert.AreEqual("Pete Peterson", author.Name);
            Assert.AreEqual("*****@*****.**", author.EMail);
        }