Beispiel #1
0
        public void Favorites_TestIdListInput_ReturnsFavoritesListWithSameCountAsInput()
        {
            mockService.Setup(fp => fp.getFavorites(testFavoriteIdList)).Returns(getFavorites(testFavoriteIdList));
            favoritesService = mockService.Object;

            FavoritesModel favoritesModel = new FavoritesModel(favoritesService, testFavoriteIdList);
            List<Favorite> favoritesList = favoritesModel.Favorites;
            Assert.AreEqual(testFavoriteIdList.Length, favoritesList.Count);
        }
Beispiel #2
0
        public void Favorites_EmptyStringParameter_ReturnsEmptyFavoritesList()
        {
            testFavoriteIdList = new string[] { "" };

            mockService.Setup(fp => fp.getFavorites(testFavoriteIdList)).Returns(getFavorites(testFavoriteIdList));
            favoritesService = mockService.Object;

            FavoritesModel favoritesModel = new FavoritesModel(favoritesService, testFavoriteIdList);
            List<Favorite> favoritesList = favoritesModel.Favorites;
            Assert.IsNotNull(favoritesList);
        }
Beispiel #3
0
        public void Favorites_TestIdListInput_ReturnsFavoritesListWithSameIdsAndOrderAsInput()
        {
            mockService.Setup(fp => fp.getFavorites(testFavoriteIdList)).Returns(getFavorites(testFavoriteIdList));
            favoritesService = mockService.Object;

            FavoritesModel favoritesModel = new FavoritesModel(favoritesService, testFavoriteIdList);
            List<Favorite> favoritesList = favoritesModel.Favorites;

            for (int i = 0; i < testFavoriteIdList.Length; i++)
            {
                var inputId = testFavoriteIdList[i];
                var outputId = favoritesList[i].Id;
                Assert.AreEqual(inputId, outputId);
            }
        }
Beispiel #4
0
 //
 // GET: /Favorites/Details?idList=1234,1235
 public ActionResult Details(string idList)
 {
     FavoritesModel favoritesModel = new FavoritesModel(favoritesService, idList.Split(','));
     return View();
 }