Exemplo n.º 1
0
        public void remove_bookmarks_by_id()
        {
            var DbService        = new BookmarkDbService(mockContext.Object);
            var mockLogicService = new Mock <BookmarkService>();
            var service          = new BookmarkService(mapper, DbService);

            //Act
            service.RemoveById("123");
            //Assert
            mockSet.Verify(m => m.Remove(It.IsAny <BookmarkDB>()), Times.Once());
        }
Exemplo n.º 2
0
        public void remove_all_bookmarks()
        {
            var DbService        = new BookmarkDbService(mockContext.Object);
            var mockLogicService = new Mock <BookmarkService>();
            var service          = new BookmarkService(mapper, DbService);

            //Act
            service.RemoveAll();

            //Assert
            mockSet.Verify(m => m.RemoveRange(It.IsAny <IEnumerable <BookmarkDB> >()), Times.Once());
        }
Exemplo n.º 3
0
        public void get_bookmarks_by_userId()
        {
            var DbService        = new BookmarkDbService(mockContext.Object);
            var mockLogicService = new Mock <BookmarkService>();
            var service          = new BookmarkService(mapper, DbService);

            //Act
            var x = service.GetByUserId("1").First();

            //Assert
            Assert.AreEqual(x.UserId, "1");
        }
Exemplo n.º 4
0
        public void get_all_bookmarks()
        {
            var DbService        = new BookmarkDbService(mockContext.Object);
            var mockLogicService = new Mock <BookmarkService>();
            var service          = new BookmarkService(mapper, DbService);

            //Act
            var x = service.GetAll();

            //Assert
            Assert.AreEqual(x.Count(), bookmarks.Select(p => p).ToList().Count());
        }
Exemplo n.º 5
0
        public async Task get_bookmark_by_id_async()
        {
            var DbService        = new BookmarkDbService(mockContext.Object);
            var mockLogicService = new Mock <BookmarkService>();
            var service          = new BookmarkService(mapper, DbService);

            //Act
            var x = await service.GetByIdAsync("123");

            //Assert
            Assert.AreEqual(x.Id, "123");
        }
Exemplo n.º 6
0
        public async Task get_bookmark_by_userId_async()
        {
            var DbService        = new BookmarkDbService(mockContext.Object);
            var mockLogicService = new Mock <BookmarkService>();
            var service          = new BookmarkService(mapper, DbService);

            //Act
            var x = await service.GetByUserIdAsync("1");

            //Assert
            Assert.AreEqual(1, x.Count());
        }
Exemplo n.º 7
0
        public async Task get_all_bookmarks_async()
        {
            //Arrage
            var DbService        = new BookmarkDbService(mockContext.Object);
            var mockLogicService = new Mock <BookmarkService>();
            var service          = new BookmarkService(mapper, DbService);

            //Act
            var q = await service.GetAllAsync();

            //Assert
            Assert.AreEqual(bookmarks.Select(p => p).ToList().Count(), q.Count());
        }
Exemplo n.º 8
0
        public void add_bookmark()
        {
            var DbService        = new BookmarkDbService(mockContext.Object);
            var mockLogicService = new Mock <BookmarkService>();
            var service          = new BookmarkService(mapper, DbService);

            //Act
            var b = new BookmarkDTO
            {
                Id    = "1",
                Title = "Title"
            };
            var q   = service.Add(b);
            var all = DbService.GetAll().Count();

            //Assert
            //mockContext.Verify(m => m.SaveChanges(), Times.Once());
            Assert.AreEqual(q.Title, b.Title);
        }