Ejemplo n.º 1
0
        public RssActionResult RSS()
        {
            IList <StoryLink>           StoryLinkList = new StoryLink().GetAllStories();
            RssActionResult <StoryLink> rss           = new RssActionResult <StoryLink>("My Stories", StoryLinkList, e => new XElement("Item",
                                                                                                                                       new XAttribute("title", e.Title),
                                                                                                                                       new XAttribute("description", e.Description),
                                                                                                                                       new XAttribute("link", e.Url)
                                                                                                                                       )
                                                                                        );

            return(rss);
        }
Ejemplo n.º 2
0
        public void RssActionResult_Success()
        {
            var responseMock = new Mock <HttpResponse>();

            responseMock.Setup(x => x.Body).Returns(new MemoryStream());

            var httpContextMock = new Mock <HttpContext>();

            httpContextMock.SetupGet(a => a.Response).Returns(responseMock.Object);

            var mockActionContext = new ActionContext()
            {
                HttpContext = httpContextMock.Object
            };

            // Create item
            var item = new SyndicationItem()
            {
                Title       = "Chavah Messianic Radio",
                Description = "The latest activity over at Chavah Messianic Radio",
                Id          = "https://messianicradio.com/",
                Published   = DateTimeOffset.UtcNow
            };

            var items = new List <SyndicationItem>
            {
                item
            };

            var feed = new SyndicationFeed("Chavah Messianic Radio",
                                           "The most recent registered users at Chavah Messianic Radio",
                                           new Uri(RadioUrl),
                                           "",
                                           items, "en-US");

            var sut = new RssActionResult(feed);

            sut.ExecuteResult(mockActionContext);

            responseMock.Verify(x => x.Body);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates an RSS feed, returning an <see cref="RssActionResult"/> for the list of <see cref="WorkItemSummary"/> objects provided,
        /// which are filtered using the parameters given.
        /// </summary>
        protected ActionResult Rss(IEnumerable <WorkItemSummary> list, string title, string projectName, string areaPath, string iterationPath, string filter)
        {
            if (!string.IsNullOrEmpty(areaPath))
            {
                areaPath = HttpUtility.UrlDecode(areaPath);
                AreaSummary summary = UserContext.Current.CurrentProject.Areas.FirstOrDefault(a => a.Path == areaPath);
                UserContext.Current.Settings.AreaName = summary.Name;
                UserContext.Current.Settings.AreaPath = summary.Path;
            }
            else if (!string.IsNullOrEmpty(iterationPath))
            {
                areaPath = HttpUtility.UrlDecode(iterationPath);
                IterationSummary summary = UserContext.Current.CurrentProject.Iterations.FirstOrDefault(i => i.Path == iterationPath);
                UserContext.Current.Settings.IterationName = summary.Name;
                UserContext.Current.Settings.IterationPath = summary.Path;
            }

            RssActionResult result = new RssActionResult();

            result.Feed = GetRssFeed(list, title);
            return(result);
        }