Exemplo n.º 1
0
        public async Task TestFavouritesGet()
        {
            using (var context = new MyMovieTrackerContext(options)) {
                UserFavouritesController favController = new UserFavouritesController(context);

                ActionResult <UserFavourites> result = await favController.GetUserFavourites(5, "tv", 123);

                Assert.AreEqual(fav[0].UserId, result.Value.UserId);
                Assert.AreEqual(fav[0].MediaType, result.Value.MediaType);
                Assert.AreEqual(fav[0].MediaId, result.Value.MediaId);
            }
        }
Exemplo n.º 2
0
        public async Task TestFavouritesGetNotFound()
        {
            using (var context = new MyMovieTrackerContext(options)) {
                UserFavouritesController favController = new UserFavouritesController(context);

                var result = await favController.GetUserFavourites(123213, "tv", 33323);

                Assert.IsNotNull(result);
                Console.WriteLine(result.Result);
                Assert.IsInstanceOfType(result.Result, typeof(NotFoundResult));
            }
        }
Exemplo n.º 3
0
        public async Task TestFavouritesGetAll()
        {
            using (var context = new MyMovieTrackerContext(options)) {
                UserFavouritesController favController = new UserFavouritesController(context);

                ActionResult <IEnumerable <UserFavourites> > result = await favController.GetUserFavourites();

                Assert.AreEqual(fav[0].UserId, result.Value.First().UserId);
                Assert.AreEqual(fav[0].MediaType, result.Value.First().MediaType);
                Assert.AreEqual(fav[0].MediaId, result.Value.First().MediaId);

                Assert.AreEqual(fav[1].UserId, result.Value.Last().UserId);
                Assert.AreEqual(fav[1].MediaType, result.Value.Last().MediaType);
                Assert.AreEqual(fav[1].MediaId, result.Value.Last().MediaId);
            }
        }