Пример #1
0
        public void Update()
        {
            ProjectList projects = new ProjectList();

            projects.Load();
            Project       project    = projects.FirstOrDefault(p => p.Name == "ProveIT");
            PortfolioList portfolios = new PortfolioList();

            portfolios.Load();
            Portfolio portfolio       = portfolios.FirstOrDefault(p => p.Name == "Brodys First Portfolio");
            Portfolio portfolioUpdate = portfolios.FirstOrDefault(p => p.Name == "Joes First Portfolio");


            PortfolioProjectList portfolioProjects = new PortfolioProjectList();

            portfolioProjects.Load();
            PortfolioProject portfolioProject = new PortfolioProject();

            portfolioProject.LoadById(portfolioProjects.FirstOrDefault(p => p.ProjectId == project.Id && p.PortfolioId == portfolio.Id).Id);

            portfolioProject.PortfolioId = portfolioUpdate.Id;
            int rowsAffected = portfolioProject.Update();

            Assert.IsTrue(rowsAffected == 1);
        }
Пример #2
0
        public void LoadById()
        {
            ProjectList projects = new ProjectList();

            projects.Load();
            Project project = projects.FirstOrDefault(p => p.Name == "ProveIT");

            PortfolioList portfolios = new PortfolioList();

            portfolios.Load();
            Portfolio portfolio = portfolios.FirstOrDefault(p => p.Name == "Brodys First Portfolio");


            PortfolioProjectList portfolioProjects = new PortfolioProjectList();

            portfolioProjects.Load();
            PortfolioProject portfolioProject = new PortfolioProject();

            portfolioProject.LoadById(portfolioProjects.FirstOrDefault(p => p.ProjectId == project.Id && p.PortfolioId == portfolio.Id).Id);

            Assert.AreEqual(portfolioProject.PortfolioId, portfolioProject.PortfolioId);
        }