public void CreateTest()
        {
            var manger = new ProjectManager();
            var project = new Project { Id = Guid.NewGuid(), Name = "test" };

            var actual = manger.Save(project);
            Assert.IsTrue(actual);
        }
        public void GetTest()
        {
            var manger = new ProjectManager();
            var project = new Project { Id = Guid.NewGuid(), Name = "test" };
            manger.Save(project);

            var proj = manger.Get(project.Id);
            Assert.IsNotNull(proj);
        }
        public void GetAllTest()
        {
            var manger = new ProjectManager();
            var project = new Project { Id = Guid.NewGuid(), Name = "test" };
            manger.Save(project);

            var projects = manger.GetAll();

            Assert.IsNotNull(projects);
            Assert.IsTrue(projects.Count() > 0);
        }
Beispiel #4
0
        public bool Save(Project project)
        {
            try
            {
                if (!_context.Projects.EntityChange(project))
                    _context.Projects.Create(project);
                else
                    _context.Projects.Update(project);
            }
            catch (Exception ex)
            {
                _logger.ErrorFormat("Exception: {0}", ex.ToString());
                return false;
            }

            return true;
        }