public void RemoveExpertDoesNotChangeClassEstimatesNoHydraulicConditions()
        {
            var treeEvent      = new TreeEvent();
            var expertToRemove = new Expert();
            var otherExpert    = new Expert();
            var project        = new Project
            {
                EventTrees =
                {
                    new EventTree
                    {
                        MainTreeEvent = treeEvent
                    }
                },
                Experts =
                {
                    expertToRemove,
                    otherExpert
                }
            };
            var projectManipulationService = new ProjectManipulationService(project);

            Assert.AreEqual(0, treeEvent.ClassesProbabilitySpecification.Count);

            projectManipulationService.RemoveExpert(expertToRemove);

            Assert.AreEqual(1, project.Experts.Count);
            Assert.AreEqual(otherExpert, project.Experts.First());
            Assert.AreEqual(0, treeEvent.ClassesProbabilitySpecification.Count);
        }
        public void RemoveExpertChangesClassEstimatesWithHydraulicConditions()
        {
            var expertToRemove      = new Expert();
            var otherExpert         = new Expert();
            var hydraulicCondition1 = new HydraulicCondition(1.0, (Probability)0.01, 1, 1);
            var hydraulicCondition2 = new HydraulicCondition(2.0, (Probability)0.001, 1, 1);
            var treeEvent           = new TreeEvent
            {
                ClassesProbabilitySpecification =
                {
                    new ExpertClassEstimation {
                        Expert = expertToRemove, HydraulicCondition = hydraulicCondition1
                    },
                    new ExpertClassEstimation {
                        Expert = expertToRemove, HydraulicCondition = hydraulicCondition2
                    },
                    new ExpertClassEstimation {
                        Expert = otherExpert, HydraulicCondition = hydraulicCondition1
                    },
                    new ExpertClassEstimation {
                        Expert = otherExpert, HydraulicCondition = hydraulicCondition2
                    }
                }
            };
            var project = new Project
            {
                EventTrees =
                {
                    new EventTree
                    {
                        MainTreeEvent = treeEvent
                    }
                },
                Experts =
                {
                    expertToRemove,
                    otherExpert
                },
                HydraulicConditions =
                {
                    hydraulicCondition1,
                    hydraulicCondition2,
                }
            };
            var projectManipulationService = new ProjectManipulationService(project);

            Assert.AreEqual(4, treeEvent.ClassesProbabilitySpecification.Count);

            projectManipulationService.RemoveExpert(expertToRemove);

            Assert.AreEqual(1, project.Experts.Count);
            Assert.AreEqual(otherExpert, project.Experts.First());
            Assert.AreEqual(2, treeEvent.ClassesProbabilitySpecification.Count);

            var firstSpecification = treeEvent.ClassesProbabilitySpecification.First();

            Assert.AreEqual(otherExpert, firstSpecification.Expert);
            Assert.AreEqual(hydraulicCondition1, firstSpecification.HydraulicCondition);
            Assert.Contains(firstSpecification.HydraulicCondition, project.HydraulicConditions);

            var secondSpecification = treeEvent.ClassesProbabilitySpecification.Last();

            Assert.AreEqual(otherExpert, secondSpecification.Expert);
            Assert.AreEqual(hydraulicCondition2, secondSpecification.HydraulicCondition);
            Assert.Contains(secondSpecification.HydraulicCondition, project.HydraulicConditions);

            Assert.AreNotEqual(firstSpecification.HydraulicCondition, secondSpecification.HydraulicCondition);
        }