Example #1
0
        public void Test_GetAllEntities()
        {
            DbContext    dbContext = new DbContextMock("TestGetAllEntities");
            List <Users> users     = Users();

            dbContext.AddRange(users);
            dbContext.SaveChanges();
            IUnitOfWork unitOfWork = new UnitOfWork(dbContext as INutritionalCalculatorContext);
            var         response   = unitOfWork.Users.GetAllEntities().Count();

            Assert.AreEqual(2, response);
        }
        public void Test_method_Get_all_entities_return_all_entities()
        {
            DbContext dbContextMock = new DbContextMock("TestGetAllEntities");
            var       users         = Users();

            dbContextMock.AddRange(users);
            dbContextMock.SaveChanges();
            ModelRepository <ModelTest> modelRepository = new ModelRepository <ModelTest>(dbContextMock as IDbContext);
            List <ModelTest>            response        = modelRepository.GetAllEntities();

            Assert.AreEqual(users.Count, response.Count);
        }