public void GetStochastNamesRecursively_TopLevelFaultTreeIllustrationPointWithFaultTreeIllustrationPointAndChildrenContainingStochasts_ReturnStochastNames() { // Setup const string stochastNameA = "Stochast A"; const string stochastNameB = "Stochast B"; var illustrationPointNode = new IllustrationPointNode(new TestFaultTreeIllustrationPoint(new[] { new Stochast(stochastNameA, 2, 4), new Stochast(stochastNameB, 1, 5) })); var topLevelFaultTreeIllustrationPoint = new TopLevelFaultTreeIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(), "closing situation", illustrationPointNode); illustrationPointNode.SetChildren(new[] { new IllustrationPointNode(new FaultTreeIllustrationPoint("Point A", 0.0, new[] { new Stochast(stochastNameA, 2, 3) }, CombinationType.And)), new IllustrationPointNode(new FaultTreeIllustrationPoint("Point B", 0.0, new[] { new Stochast(stochastNameB, 2, 3) }, CombinationType.And)) }); // Call IEnumerable <string> names = topLevelFaultTreeIllustrationPoint.GetStochastNamesRecursively(); // Assert CollectionAssert.AreEqual(new[] { stochastNameA, stochastNameB, stochastNameA, stochastNameB }, names); }
public void GetStochastNamesRecursively_TopLevelFaultTreeIllustrationPointWithFaultTreeIllustrationPointAndNoChildren_ReturnStochastNames() { // Setup const string stochastNameA = "Stochast A"; const string stochastNameB = "Stochast B"; var topLevelFaultTreeIllustrationPoint = new TopLevelFaultTreeIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(), "closing situation", new IllustrationPointNode(new TestFaultTreeIllustrationPoint(new[] { new Stochast(stochastNameA, 4, 2), new Stochast(stochastNameB, 5, 4) }))); // Call IEnumerable <string> names = topLevelFaultTreeIllustrationPoint.GetStochastNamesRecursively(); // Assert CollectionAssert.AreEqual(new[] { stochastNameA, stochastNameB }, names); }