public void Constructor_ValidArguments_ReturnExpectedValues() { // Setup var data = new TestIllustrationPoint(); // Call var illustrationPointNode = new IllustrationPointNode(data); // Assert Assert.IsInstanceOf <ICloneable>(illustrationPointNode); Assert.AreSame(data, illustrationPointNode.Data); CollectionAssert.IsEmpty(illustrationPointNode.Children); }
protected override IEnumerable <IllustrationPointControlItem> GetIllustrationPointControlItems() { GeneralResult <TestTopLevelIllustrationPoint> generalResult = GetGeneralResultFunc(); if (generalResult == null) { return(Enumerable.Empty <IllustrationPointControlItem>()); } var illustrationPoint = new TestIllustrationPoint(); return(generalResult.TopLevelIllustrationPoints.Select( p => new IllustrationPointControlItem( p, p.WindDirection.Name, p.ClosingSituation, stochasts, illustrationPoint.Beta)).ToArray()); }
public void CreateGraphNode_WithNotSupportedIllustrationPoint_ThrowsNotSupportedException() { // Setup var illustrationPoint = new TestIllustrationPoint(); // Call void Call() => RiskeerGraphNodeFactory.CreateGraphNode(illustrationPoint, new[] { CreateTestGraphNode() }); // Assert var exception = Assert.Throws <NotSupportedException>(Call); Assert.AreEqual($"IllustrationPointNode of type {illustrationPoint.GetType().Name} is not supported. " + $"Supported types: {nameof(FaultTreeIllustrationPoint)} and {nameof(SubMechanismIllustrationPoint)}", exception.Message); }
private static void AssertIllustrationPointControlItems(GeneralResult <TestTopLevelIllustrationPoint> generalResult, IllustrationPointsControl illustrationPointsControl) { TestTopLevelIllustrationPoint topLevelFaultTreeIllustrationPoint1 = generalResult.TopLevelIllustrationPoints.ElementAt(0); TestTopLevelIllustrationPoint topLevelFaultTreeIllustrationPoint2 = generalResult.TopLevelIllustrationPoints.ElementAt(1); var illustrationPoint = new TestIllustrationPoint(); var expectedControlItems = new[] { new IllustrationPointControlItem(topLevelFaultTreeIllustrationPoint1, topLevelFaultTreeIllustrationPoint1.WindDirection.Name, topLevelFaultTreeIllustrationPoint1.ClosingSituation, stochasts, illustrationPoint.Beta), new IllustrationPointControlItem(topLevelFaultTreeIllustrationPoint2, topLevelFaultTreeIllustrationPoint2.WindDirection.Name, topLevelFaultTreeIllustrationPoint2.ClosingSituation, stochasts, illustrationPoint.Beta) }; CollectionAssert.AreEqual(expectedControlItems, illustrationPointsControl.Data, new IllustrationPointControlItemComparer()); }