Beispiel #1
0
 public virtual ActionResult Items(StreamFilter filter)
 {
     var items = Mapper.Map<IEnumerable<ItemCompactView>>(this.streamService.GetItems(filter));
     return View(new ItemsView
         {
             Items = items,
             Filter = filter
         });
 }
Beispiel #2
0
        public IEnumerable<Item> GetItems(StreamFilter filter)
        {
            var url = new UrlBuilder(this.baseUrl)
                .WithParameter("type", filter.Type)
                .WithParameter("from", filter.From)
                .WithParameter("to", filter.To)
                .WithParameter("limit", filter.Limit)
                .Build();

            return this.jsonClient.Get<IEnumerable<Item>>(url);
        }
        public void Given_Filter_GetListUrl_Should_Produce_Correct_Url()
        {
            var filter = new StreamFilter
                {
                    From = new DateTime(2001, 1, 1),
                    Type = ItemType.Rss
                };

            var id = ObjectId.GenerateNewId();

            var jsonClient = new Mock<IJsonClient>();
            jsonClient.Setup(x => x.Get<IEnumerable<Item>>(It.IsAny<string>())).Returns(new List<Item> { new Item { Id = id.ToString() } });

            var streamService = new StreamService("http://api.dotnetgroup.dev", jsonClient.Object);
            var items = streamService.GetItems(filter).ToList();

            Assert.AreEqual(1, items.Count());
            Assert.AreEqual(id.ToString(), items[0].Id);
        }
Beispiel #4
0
 public virtual ActionResult Index(StreamFilter filter)
 {
     return View(filter);
 }