public void RestaurantToDisplayNoReviews()
        {
            var result   = dsc.ToDisplay(restaurants[2]);
            var expected = restaurants[2];

            Assert.AreEqual(expected.Id, result.Id);
            Assert.AreEqual(expected.Name, result.Name);
            Assert.AreEqual(expected.Address, result.Address);
            Assert.AreEqual(expected.Phone, result.Phone);
        }
        public void ReviewToDisplayAnon()
        {
            var r = new Review()
            {
                Name          = "",
                Body          = "",
                DatePublished = now,
                Id            = 8,
                Rating        = 4,
                RestaurantId  = 1,
                Title         = "Good"
            };

            var result = dsc.ToDisplay(r);

            Assert.AreEqual("Anonymous", result.ReviewerName);
            Assert.AreEqual(now.ToShortDateString(), result.DatePublished);
            Assert.AreEqual(r.Rating, result.Rating);
            Assert.AreEqual(r.Title, result.Title);
            Assert.AreEqual(r.Body, result.Body);
        }
Exemplo n.º 3
0
 public List <RestaurantDisplay> ViewTopRestaurants()
 {
     return(dsp.ToDisplay(_workUnit.Restaurants.GetTopRestaurants(3)));
 }
Exemplo n.º 4
0
        public List <RestaurantDisplay> ViewTopRestaurants()
        {
            var rests = dsp.ToDisplay(_workUnit.Restaurants.GetRestaurantsReviews());

            return(rests.OrderByDescending(r => r.Rating).Take(3).ToList());
        }