public void ProjectTotalEstimateWithClosedChild()
        {
            var childProject = EntityFactory.CreateSubProject("Son of " + SandboxName, DateTime.Now, null, SandboxProject);
            var storyA       = EntityFactory.CreateStory("Story A", SandboxProject);
            var defectB      = EntityFactory.CreateDefect("Defect B", SandboxProject);

            var storyC  = EntityFactory.CreateStory("Story C", childProject);
            var defectD = EntityFactory.CreateDefect("Defect D", childProject);

            storyA.Estimate  = 5;
            defectB.Estimate = 10;

            storyC.Estimate  = 2;
            defectD.Estimate = 3;

            storyA.Save();
            defectB.Save();
            storyC.Save();
            defectD.Save();

            // Close child project:
            childProject.Close();

            ResetInstance();

            // Expect to exclude Open workitems in closed child projects
            Assert.AreEqual(15, SandboxProject.GetTotalEstimate(null, true), "Expect to exclude Open workitems in closed child projects");
            Assert.AreEqual(15, SandboxProject.GetTotalEstimate(new PrimaryWorkitemFilter(), true), "Expect to exclude Open workitems in closed child projects");
            Assert.AreEqual(5, SandboxProject.GetTotalEstimate(new StoryFilter(), true), "Expect to exclude Open workitems in closed child projects");
            Assert.AreEqual(10, SandboxProject.GetTotalEstimate(new DefectFilter(), true), "Expect to exclude Open workitems in closed child projects");
        }
        public void ProjectTotalEstimateAndDown()
        {
            var childProject = EntityFactory.CreateSubProject("Son of " + SandboxName, DateTime.Now, null, SandboxProject);
            var storyA       = EntityFactory.CreateStory("Story A", SandboxProject);
            var defectB      = EntityFactory.CreateDefect("Defect B", SandboxProject);

            var storyC  = EntityFactory.CreateStory("Story C", childProject);
            var defectD = EntityFactory.CreateDefect("Defect D", childProject);

            storyA.Estimate  = 5;
            defectB.Estimate = 10;

            storyC.Estimate  = 2;
            defectD.Estimate = 3;

            storyA.Save();
            defectB.Save();
            storyC.Save();
            defectD.Save();

            //Epic rogue = SandboxProject.CreateEpic("Rogue");
            //rogue.Estimate = 13.37;
            //rogue.Save();

            Assert.AreEqual(20, SandboxProject.GetTotalEstimate(null, true));
            Assert.AreEqual(20, SandboxProject.GetTotalEstimate(new PrimaryWorkitemFilter(), true));
            Assert.AreEqual(7, SandboxProject.GetTotalEstimate(new StoryFilter(), true));
            Assert.AreEqual(13, SandboxProject.GetTotalEstimate(new DefectFilter(), true));
        }
        public void ProjectTotalDoneAndDown()
        {
            var childProject = EntityFactory.CreateSubProject("Son of " + SandboxName, DateTime.Now, null, SandboxProject);
            var storyA       = EntityFactory.CreateStory("Story A", SandboxProject);
            var defectB      = EntityFactory.CreateDefect("Defect B", SandboxProject);

            var storyC  = EntityFactory.CreateStory("Story C", childProject);
            var defectD = EntityFactory.CreateDefect("Defect D", childProject);

            storyA.CreateTask("Task 1").CreateEffort(5);
            defectB.CreateEffort(10);
            storyC.CreateTest("Test 1").CreateEffort(2);
            defectD.CreateEffort(1);

            var rogue = SandboxProject.CreateDefect("Rogue");

            rogue.CreateEffort(13.37);
            rogue.Delete();

            Assert.AreEqual(18, SandboxProject.GetTotalDone(null, true));
            Assert.AreEqual(18, SandboxProject.GetTotalDone(new WorkitemFilter(), true));
            Assert.AreEqual(11, SandboxProject.GetTotalDone(new PrimaryWorkitemFilter(), true));
            Assert.AreEqual(null, SandboxProject.GetTotalDone(new StoryFilter(), true));
            Assert.AreEqual(11, SandboxProject.GetTotalDone(new DefectFilter(), true));
            Assert.AreEqual(7, SandboxProject.GetTotalDone(new SecondaryWorkitemFilter(), true));
            Assert.AreEqual(5, SandboxProject.GetTotalDone(new TaskFilter(), true));
            Assert.AreEqual(2, SandboxProject.GetTotalDone(new TestFilter(), true));
        }
        public void ProjectTotalDetailEstimateAndDown()
        {
            var childProject = EntityFactory.CreateSubProject("Son of " + SandboxName, DateTime.Now, null, SandboxProject);
            var storyA       = EntityFactory.CreateStory("Story A", SandboxProject);
            var defectB      = EntityFactory.CreateDefect("Defect B", SandboxProject);

            var storyC  = EntityFactory.CreateStory("Story C", childProject);
            var defectD = EntityFactory.CreateDefect("Defect D", childProject);

            var task1 = storyA.CreateTask("Task 1");

            task1.DetailEstimate   = 5;
            defectB.DetailEstimate = 10;

            var test1 = storyC.CreateTest("Test 1");

            test1.DetailEstimate   = 2;
            defectD.DetailEstimate = 3;

            task1.Save();
            defectB.Save();
            test1.Save();
            defectD.Save();

            var rogue = SandboxProject.CreateDefect("Rogue");

            rogue.DetailEstimate = 13.37;
            rogue.Save();
            rogue.Delete();

            Assert.AreEqual(20, SandboxProject.GetTotalDetailEstimate(null, true));
            Assert.AreEqual(20, SandboxProject.GetTotalDetailEstimate(new WorkitemFilter(), true));
            Assert.AreEqual(13, SandboxProject.GetTotalDetailEstimate(new PrimaryWorkitemFilter(), true));
            Assert.AreEqual(null, SandboxProject.GetTotalDetailEstimate(new StoryFilter(), true));
            Assert.AreEqual(13, SandboxProject.GetTotalDetailEstimate(new DefectFilter(), true));
            Assert.AreEqual(7, SandboxProject.GetTotalDetailEstimate(new SecondaryWorkitemFilter(), true));
            Assert.AreEqual(5, SandboxProject.GetTotalDetailEstimate(new TaskFilter(), true));
            Assert.AreEqual(2, SandboxProject.GetTotalDetailEstimate(new TestFilter(), true));
        }