Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/CalculationTreeNodeInfoFactoryTest.cs =================================================================== diff -u -rfd98bcf5d1811dbcad2cc0e292a4349f8402b83a -r2c8727ab981f791b6324428b063c414c45a607a3 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/CalculationTreeNodeInfoFactoryTest.cs (.../CalculationTreeNodeInfoFactoryTest.cs) (revision fd98bcf5d1811dbcad2cc0e292a4349f8402b83a) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/CalculationTreeNodeInfoFactoryTest.cs (.../CalculationTreeNodeInfoFactoryTest.cs) (revision 2c8727ab981f791b6324428b063c414c45a607a3) @@ -433,11 +433,12 @@ [Test] public void CreateCalculationGroupContextTreeNodeInfo_Always_ExpectedPropertiesSet() { - // Setup & Call + // Setup Func childNodeObjects = context => new object[0]; Func contextMenuStrip = (context, parent, treeViewControl) => new ContextMenuStrip(); Action onNodeRemoved = (context, parent) => { }; + // Call var treeNodeInfo = CalculationTreeNodeInfoFactory.CreateCalculationGroupContextTreeNodeInfo(childNodeObjects, contextMenuStrip, onNodeRemoved); // Assert @@ -973,8 +974,79 @@ } } - # endregion + #endregion + #region CreateCalculationContextTreeNodeInfo + + [Test] + public void CreateCalculationContextTreeNodeInfo_Always_ExpectedPropertiesSet() + { + // Call + var treeNodeInfo = CalculationTreeNodeInfoFactory.CreateCalculationContextTreeNodeInfo(null); + + // Assert + Assert.AreEqual(typeof(TestCalculationContext), treeNodeInfo.TagType); + Assert.IsNull(treeNodeInfo.ForeColor); + Assert.IsNull(treeNodeInfo.CanCheck); + Assert.IsNull(treeNodeInfo.IsChecked); + Assert.IsNull(treeNodeInfo.OnNodeChecked); + } + + [Test] + public void TextOfCalculationContextTreeNodeInfo_Always_ReturnsWrappedDataName() + { + // Setup + var mocks = new MockRepository(); + var failureMechanismMock = mocks.StrictMock(); + + mocks.ReplayAll(); + + var calculationName = "calculationName"; + var calculation = new TestCalculation + { + Name = calculationName + }; + + var context = new TestCalculationContext(calculation, failureMechanismMock); + var treeNodeInfo = CalculationTreeNodeInfoFactory.CreateCalculationContextTreeNodeInfo(null); + + // Call + var text = treeNodeInfo.Text(context); + + // Assert + Assert.AreEqual(calculationName, text); + mocks.VerifyAll(); + } + + [Test] + public void ImageOfCalculationContextTreeNodeInfo_Always_ReturnsIcon() + { + // Setup + var icon = RingtoetsFormsResources.CalculateIcon; + var treeNodeInfo = CalculationTreeNodeInfoFactory.CreateCalculationContextTreeNodeInfo(icon); + + // Call + var image = treeNodeInfo.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(icon, image); + } + + [Test] + public void EnsureVisibleOnCreateOfCalculationContextTreeNodeInfo_Always_ReturnsTrue() + { + // Setup + var treeNodeInfo = CalculationTreeNodeInfoFactory.CreateCalculationContextTreeNodeInfo(null); + + // Call + var result = treeNodeInfo.EnsureVisibleOnCreate(null, null); + + // Assert + Assert.IsTrue(result); + } + + #endregion + # region Nested types private class TestCalculationGroupContext : Observable, ICalculationContext