public void RemoveHydraulicConditionDoesNotChangeClassEstimatesNoExperts() { var treeEvent = new TreeEvent(); var hydraulicConditionToRemove = new HydraulicCondition(1.0, (Probability)0.01, 1, 1); var hydraulicCondition2 = new HydraulicCondition(2.0, (Probability)0.001, 1, 1); var project = new Project { EventTrees = { new EventTree { MainTreeEvent = treeEvent } }, HydraulicConditions = { hydraulicConditionToRemove, hydraulicCondition2, } }; var projectManipulationService = new ProjectManipulationService(project); Assert.AreEqual(0, treeEvent.ClassesProbabilitySpecification.Count); projectManipulationService.RemoveHydraulicCondition(hydraulicConditionToRemove); Assert.AreEqual(1, project.HydraulicConditions.Count); Assert.AreEqual(hydraulicCondition2, project.HydraulicConditions.First()); Assert.AreEqual(0, treeEvent.ClassesProbabilitySpecification.Count); }
public void RemoveHydraulicConditionChangesClassEstimatesWithExperts() { var expert1 = new Expert(); var expert2 = new Expert(); var hydraulicConditionToRemove = 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 = expert1, HydraulicCondition = hydraulicConditionToRemove }, new ExpertClassEstimation { Expert = expert1, HydraulicCondition = hydraulicCondition2 }, new ExpertClassEstimation { Expert = expert2, HydraulicCondition = hydraulicConditionToRemove }, new ExpertClassEstimation { Expert = expert2, HydraulicCondition = hydraulicCondition2 } } }; var project = new Project { EventTrees = { new EventTree { MainTreeEvent = treeEvent } }, Experts = { expert1, expert2 }, HydraulicConditions = { hydraulicConditionToRemove, hydraulicCondition2, } }; var projectManipulationService = new ProjectManipulationService(project); Assert.AreEqual(4, treeEvent.ClassesProbabilitySpecification.Count); projectManipulationService.RemoveHydraulicCondition(hydraulicConditionToRemove); Assert.AreEqual(1, project.HydraulicConditions.Count); Assert.AreEqual(hydraulicCondition2, project.HydraulicConditions.First()); Assert.AreEqual(2, treeEvent.ClassesProbabilitySpecification.Count); var firstSpecification = treeEvent.ClassesProbabilitySpecification.First(); Assert.AreEqual(hydraulicCondition2, firstSpecification.HydraulicCondition); Assert.AreEqual(expert1, firstSpecification.Expert); Assert.Contains(firstSpecification.Expert, project.Experts); var secondSpecification = treeEvent.ClassesProbabilitySpecification.Last(); Assert.AreEqual(hydraulicCondition2, secondSpecification.HydraulicCondition); Assert.AreEqual(expert2, secondSpecification.Expert); Assert.Contains(secondSpecification.Expert, project.Experts); Assert.AreNotEqual(firstSpecification.Expert, secondSpecification.Expert); }