public void Setup()
        {
            using (PlannerContext pc = new PlannerContext())
            {
                var _selectedProject =
                    from p in pc.Projects
                    where p.Title == "TestProj"
                    select p;

                var _selectedFeature =
                    from f in pc.Features
                    where f.Title == "TestFeat"
                    select f;

                var _selectedIssue =
                    from i in pc.Issues
                    where i.Title == "TestIssue"
                    select i;

                var _selectedNote =
                    from n in pc.Notes
                    where n.Title == "TestNote"
                    select n;

                Project _tempProj = new Project()
                {
                    Title       = "temp",
                    Description = "Temp Temp",
                    Status      = 1,
                    Link        = "Temporary"
                };

                pc.RemoveRange(_selectedProject);
                pc.RemoveRange(_selectedFeature);
                pc.RemoveRange(_selectedIssue);
                pc.RemoveRange(_selectedNote);

                pc.Projects.Add(_tempProj);

                pc.SaveChanges();

                _crudProjectManager.SelectedProject = _tempProj;

                File.Delete(@"C:\Users\Alex\Documents\Engineering 73\Entity Framework Project\Entity-Framework-Project-Planner\ProjectPlanner\ProjectPlannerTESTS\bin\Debug\netcoreapp3.1\JSON Export\Projects.json");
                File.Delete(@"C:\Users\Alex\Documents\Engineering 73\Entity Framework Project\Entity-Framework-Project-Planner\ProjectPlanner\ProjectPlannerTESTS\bin\Debug\netcoreapp3.1\JSON Export\Features.json");
                File.Delete(@"C:\Users\Alex\Documents\Engineering 73\Entity Framework Project\Entity-Framework-Project-Planner\ProjectPlanner\ProjectPlannerTESTS\bin\Debug\netcoreapp3.1\JSON Export\Issues.json");
                File.Delete(@"C:\Users\Alex\Documents\Engineering 73\Entity Framework Project\Entity-Framework-Project-Planner\ProjectPlanner\ProjectPlannerTESTS\bin\Debug\netcoreapp3.1\JSON Export\Notes.json");
            }
        }
コード例 #2
0
        public void Setup()
        {
            using (PlannerContext pc = new PlannerContext())
            {
                var _selectedProject =
                    from p in pc.Projects
                    where p.Title == "TestProj"
                    select p;

                var _selectedFeature =
                    from f in pc.Features
                    where f.Title == "TestFeat"
                    select f;

                var _selectedIssue =
                    from i in pc.Issues
                    where i.Title == "TestIssue"
                    select i;

                var _selectedNote =
                    from n in pc.Notes
                    where n.Title == "TestNote"
                    select n;

                Project _tempProj = new Project()
                {
                    Title       = "temp",
                    Description = "Temp Temp",
                    Status      = 1,
                    Link        = "Temporary"
                };

                pc.RemoveRange(_selectedProject);
                pc.RemoveRange(_selectedFeature);
                pc.RemoveRange(_selectedIssue);
                pc.RemoveRange(_selectedNote);

                pc.Projects.Add(_tempProj);

                pc.SaveChanges();

                _crudProjectManager.SelectedProject = _tempProj;
            }
        }
        public void TearDown()
        {
            using (PlannerContext pc = new PlannerContext())
            {
                var _selectedProject =
                    from p in pc.Projects
                    where p.Title == "TestProj"
                    select p;

                var _selectedProject2 =
                    from p in pc.Projects
                    where p.Title == "TestProj2"
                    select p;

                var _selectedProject3 =
                    from p in pc.Projects
                    where p.Title == "TestProj3"
                    select p;

                var _selectedFeature =
                    from f in pc.Features
                    where f.Title == "TestFeat"
                    select f;

                var _selectedIssue =
                    from i in pc.Issues
                    where i.Title == "TestIssue"
                    select i;

                var _selectedNote =
                    from n in pc.Notes
                    where n.Title == "TestNote"
                    select n;

                var _tempProj =
                    from p in pc.Projects
                    where p.Title == "temp"
                    select p;

                pc.RemoveRange(_selectedProject);
                pc.RemoveRange(_selectedProject2);
                pc.RemoveRange(_selectedProject3);
                pc.RemoveRange(_selectedFeature);
                pc.RemoveRange(_selectedIssue);
                pc.RemoveRange(_selectedNote);
                pc.RemoveRange(_tempProj);

                pc.SaveChanges();

                File.Delete(@"C:\Users\Alex\Documents\Engineering 73\Entity Framework Project\Entity-Framework-Project-Planner\ProjectPlanner\ProjectPlannerTESTS\bin\Debug\netcoreapp3.1\JSON Export\Projects.json");
                File.Delete(@"C:\Users\Alex\Documents\Engineering 73\Entity Framework Project\Entity-Framework-Project-Planner\ProjectPlanner\ProjectPlannerTESTS\bin\Debug\netcoreapp3.1\JSON Export\Features.json");
                File.Delete(@"C:\Users\Alex\Documents\Engineering 73\Entity Framework Project\Entity-Framework-Project-Planner\ProjectPlanner\ProjectPlannerTESTS\bin\Debug\netcoreapp3.1\JSON Export\Issues.json");
                File.Delete(@"C:\Users\Alex\Documents\Engineering 73\Entity Framework Project\Entity-Framework-Project-Planner\ProjectPlanner\ProjectPlannerTESTS\bin\Debug\netcoreapp3.1\JSON Export\Notes.json");
            }
        }
コード例 #4
0
        public void TearDown()
        {
            using (PlannerContext pc = new PlannerContext())
            {
                var _selectedProject =
                    from p in pc.Projects
                    where p.Title == "TestProj"
                    select p;

                var _selectedProject2 =
                    from p in pc.Projects
                    where p.Title == "TestProj2"
                    select p;

                var _selectedProject3 =
                    from p in pc.Projects
                    where p.Title == "TestProj3"
                    select p;

                var _selectedFeature =
                    from f in pc.Features
                    where f.Title == "TestFeat"
                    select f;

                var _selectedIssue =
                    from i in pc.Issues
                    where i.Title == "TestIssue"
                    select i;

                var _selectedNote =
                    from n in pc.Notes
                    where n.Title == "TestNote"
                    select n;

                var _tempProj =
                    from p in pc.Projects
                    where p.Title == "temp"
                    select p;

                pc.RemoveRange(_selectedProject);
                pc.RemoveRange(_selectedProject2);
                pc.RemoveRange(_selectedProject3);
                pc.RemoveRange(_selectedFeature);
                pc.RemoveRange(_selectedIssue);
                pc.RemoveRange(_selectedNote);
                pc.RemoveRange(_tempProj);

                pc.SaveChanges();
            }
        }
コード例 #5
0
        public void DeleteProject()
        {
            using (PlannerContext pc = new PlannerContext())
            {
                var _deleteProject =
                    from p in pc.Projects
                    where p.ProjectId == SelectedProject.ProjectId
                    select p;

                foreach (var item in _deleteProject)
                {
                    pc.RemoveRange(item);
                }

                pc.SaveChanges();
            }
        }