Exemplo n.º 1
0
        public void updateProjectTest()
        {
            db.addUser(testUser);

            int numUsers = db.retrieveAllUsers().Count;
            int lastUserID = db.retrieveAllUserIds().Last();

            db.addPortfolio(testPortfolio, lastUserID);
            int numPortfolios = db.retrieveAllPortfolios().Count;

            int lastPortID = db.retrieveAllPortfolios().Last().Id;

            int initialNumProjects = db.retrieveAllProjects().Count;
            db.addProjectToPortfolio(testProject, lastPortID);
            int finalNumProjects = db.retrieveAllProjects().Count;

            Assert.AreEqual(initialNumProjects + 1, finalNumProjects, "Project Add Failed");

            var lastID = db.retrieveAllNotifications().Last().Id;

            Project testEdit = new Project()
            {
                Title = "EditedTitle",
                Description = "EditedDescription",
                Template = 1,
                CollaborationSetting = 1,
                Id = lastID

            };

            db.updateProject(testEdit, lastPortID);

            Project updatedProject = db.retrieveProject(lastID);
            Assert.AreEqual(testEdit.Title, updatedProject.Title, "Project Update Failed (Title)");
            Assert.AreEqual(testEdit.Description, updatedProject.Description, "Project Update Failed (Description)");
            Assert.AreEqual(testEdit.Template, updatedProject.Template, "Project Update Failed (Template)");
            Assert.AreEqual(testEdit.CollaborationSetting, updatedProject.CollaborationSetting, "Project Update Failed (CollaborationSetting)");
        }
        public void addProjectTest()
        {
            Project testP = new Project()
            {
                Title = "TestTitle",
                Description = "TestDescription", Contributions = new List<Contribution>(),
                Media = new List<Medium>(), Portfolios = new List<Portfolio>(), Template = 1,
                ProjectPermissions = new List<ProjectPermission>()
            };
            int initialNumProjects = db.retrieveAllProjects().Count;
            db.addProject(testP, 5);
            int finalNumProjects = db.retrieveAllProjects().Count;

            Assert.AreEqual(initialNumProjects + 1, finalNumProjects, "Project Add Failed");
        }