コード例 #1
0
        public void AddHydraulicConditionDoesNotChangesClassEstimatesNoExperts()
        {
            var treeEvent = new TreeEvent();
            var project   = new Project
            {
                EventTrees = { new EventTree
                               {
                                   MainTreeEvent = treeEvent
                               } }
            };
            var projectManipulationService = new ProjectManipulationService(project);

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

            var hydraulicCondition = new HydraulicCondition(1.0, (Probability)0.01, 1, 1);

            projectManipulationService.AddHydraulicCondition(hydraulicCondition);

            Assert.AreEqual(1, project.HydraulicConditions.Count);
            Assert.AreEqual(hydraulicCondition, project.HydraulicConditions.First());
            Assert.AreEqual(0, treeEvent.ClassesProbabilitySpecification.Count);
        }
コード例 #2
0
        public void AddHydraulicConditionChangesClassEstimatesWithExperts()
        {
            var treeEvent = new TreeEvent();
            var project   = new Project
            {
                EventTrees = { new EventTree
                               {
                                   MainTreeEvent = treeEvent
                               } },
                Experts =
                {
                    new Expert(),
                    new Expert()
                }
            };
            var projectManipulationService = new ProjectManipulationService(project);

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

            var hydraulicCondition = new HydraulicCondition(1.0, (Probability)0.01, 1, 1);

            projectManipulationService.AddHydraulicCondition(hydraulicCondition);

            Assert.AreEqual(1, project.HydraulicConditions.Count);
            Assert.AreEqual(hydraulicCondition, project.HydraulicConditions.First());
            Assert.AreEqual(2, treeEvent.ClassesProbabilitySpecification.Count);
            var firstSpecification = treeEvent.ClassesProbabilitySpecification.First();

            Assert.AreEqual(hydraulicCondition, firstSpecification.HydraulicCondition);
            Assert.Contains(firstSpecification.Expert, project.Experts);

            var secondSpecification = treeEvent.ClassesProbabilitySpecification.Last();

            Assert.AreEqual(hydraulicCondition, secondSpecification.HydraulicCondition);
            Assert.Contains(secondSpecification.Expert, project.Experts);

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