public void ForeColor_CollectionHasElementsEmpty_ReturnControlText() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new HeightStructuresFailureMechanism(); failureMechanism.HeightStructures.AddRange(new[] { new TestHeightStructure("id", "TestHeightStructure") }, "some path"); // Precondition CollectionAssert.IsNotEmpty(failureMechanism.HeightStructures); var heightStructuresContext = new HeightStructuresContext(failureMechanism.HeightStructures, failureMechanism, assessmentSection); // Call Color color = info.ForeColor(heightStructuresContext); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color); mocks.VerifyAll(); }
public void ForeColor_HasNoOutput_ReturnGrayText() { // Call Color color = info.ForeColor(new GrassCoverErosionInwardsOutputContext(new GrassCoverErosionInwardsCalculation())); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); }
public void ForeColor_HasNoOutput_ReturnGrayText() { // Setup var context = new ProbabilisticPipingOutputContext(new ProbabilisticPipingCalculationScenario()); // Call Color color = info.ForeColor(context); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); }
public void ForeColor_HasNoOutput_ReturnGrayText() { // Setup var structuresCalculation = mocksRepository.Stub <IStructuresCalculation>(); mocksRepository.ReplayAll(); // Call Color color = info.ForeColor(new StructuresOutputContext(structuresCalculation)); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); }
public void ForeColor_DuneLocationsPresent_ReturnControlText() { // Setup var failureMechanism = new DuneErosionFailureMechanism(); failureMechanism.SetDuneLocations(new[] { new TestDuneLocation() }); var calculationsGroupContext = new DuneLocationCalculationsForUserDefinedTargetProbabilitiesGroupContext( new ObservableList <DuneLocationCalculationsForTargetProbability>(), failureMechanism, new AssessmentSectionStub()); using (var plugin = new DuneErosionPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Color textColor = info.ForeColor(calculationsGroupContext); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), textColor); } }
public void ForeColor_HasSectionsOnFailureMechanism_ReturnControlText() { // Setup var assessmentSection = mocks.Stub <IAssessmentSection>(); var failureMechanism = mocks.Stub <IFailureMechanism <FailureMechanismSectionResult> >(); failureMechanism.Stub(fm => fm.Sections).Return(new[] { new FailureMechanismSection("A", new[] { new Point2D(3, 4), new Point2D(5, 6) }) }); mocks.ReplayAll(); var context = new FailureMechanismSectionsContext(failureMechanism, assessmentSection); using (var plugin = new RiskeerPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Color color = info.ForeColor(context); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color); } mocks.VerifyAll(); }
public void ForeColor_CollectionIsEmpty_ReturnGrayText() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new StabilityPointStructuresFailureMechanism(); // Precondition CollectionAssert.IsEmpty(failureMechanism.StabilityPointStructures); var context = new StabilityPointStructuresContext(failureMechanism.StabilityPointStructures, failureMechanism, assessmentSection); using (var plugin = new StabilityPointStructuresPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Color color = info.ForeColor(context); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); } mocks.VerifyAll(); }
public void ForeColor_HasSectionsOnFailureMechanism_ReturnControlText() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new PipingFailureMechanism(); failureMechanism.SetSections(new[] { new FailureMechanismSection("A", new[] { new Point2D(3, 4), new Point2D(5, 6) }) }, "B"); var context = new PipingFailureMechanismSectionsContext(failureMechanism, assessmentSection); using (var plugin = new PipingPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Color color = info.ForeColor(context); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color); } mocks.VerifyAll(); }
public void ForeColor_CollectionWithoutSurfaceLines_ReturnsGrayText() { // Setup var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new PipingFailureMechanism(); var surfaceLines = new PipingSurfaceLineCollection(); var pipingSurfaceLines = new PipingSurfaceLinesContext(surfaceLines, failureMechanism, assessmentSection); // Call Color foreColor = info.ForeColor(pipingSurfaceLines); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), foreColor); }
public void ForeColor_HasNoOutput_ReturnGrayText() { // Setup var calculation = new GrassCoverErosionInwardsCalculation { Output = new GrassCoverErosionInwardsOutput( new TestOvertoppingOutput(0.5), null, null) }; // Call Color color = info.ForeColor(new DikeHeightOutputContext(calculation)); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); }
public void ForeColor_CollectionIsEmpty_ReturnGrayText() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); var failureMechanism = mocks.Stub <ICalculatableFailureMechanism>(); mocks.ReplayAll(); var emptyCollection = new ForeshoreProfileCollection(); var context = new ForeshoreProfilesContext(emptyCollection, failureMechanism, assessmentSection); // Call Color color = info.ForeColor(context); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); mocks.ReplayAll(); }
public void ForeColor_HasOutputTrue_ReturnControlText() { // Setup var failureMechanism = new MacroStabilityInwardsFailureMechanism(); IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(failureMechanism, mocks); var scenario = new MacroStabilityInwardsCalculationScenario { Output = MacroStabilityInwardsOutputTestFactory.CreateOutput() }; var context = new MacroStabilityInwardsOutputContext(scenario, failureMechanism, assessmentSection); // Call Color color = info.ForeColor(context); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color); mocks.VerifyAll(); }
public void ForeColor_CollectionWithoutSoilModels_ReturnsGrayText() { // Setup var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new PipingFailureMechanism(); var stochasticSoilModelCollectionContext = new PipingStochasticSoilModelCollectionContext( failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); // Call Color foreColor = info.ForeColor(stochasticSoilModelCollectionContext); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), foreColor); }
public void ForeColor_Always_ReturnControlText() { // Setup mocks.ReplayAll(); // Call Color foreColor = info.ForeColor(null); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), foreColor); }
public void ForeColor_Always_ReturnsGrayText() { // Setup mocks.ReplayAll(); // Call Color textColor = info.ForeColor(null); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), textColor); }
public void ForeColor_CollectionIsEmpty_ReturnGrayText() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); // Precondition CollectionAssert.IsEmpty(failureMechanism.DikeProfiles); var context = new DikeProfilesContext(failureMechanism.DikeProfiles, failureMechanism, assessmentSection); // Call Color color = info.ForeColor(context); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); mocks.VerifyAll(); }
public void ForeColor_Always_ReturnGrayText() { // Setup var output = new EmptyGrassCoverErosionOutwardsOutput(); using (var plugin = new GrassCoverErosionOutwardsPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Color color = info.ForeColor(output); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); } }
public void ForeColor_Always_ReturnGrayText() { // Setup var output = new EmptyWaveImpactAsphaltCoverOutput(); using (var plugin = new WaveImpactAsphaltCoverPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Color color = info.ForeColor(output); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); } }
public void ForeColor_ArbitraryBackgroundDataConfiguration_ReturnControlText() { // Setup var backgroundData = new BackgroundData(new TestBackgroundDataConfiguration()); using (var plugin = new RiskeerPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Color image = info.ForeColor(backgroundData); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), image); } }
public void ForeColor_UnconnectedWtmsBackgroundDataConfiguration_ReturnGrayText() { // Setup WmtsMapData mapData = WmtsMapDataTestHelper.CreateUnconnectedMapData(); BackgroundData backgroundData = BackgroundDataConverter.ConvertTo(mapData); using (var plugin = new RiskeerPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Color image = info.ForeColor(backgroundData); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), image); } }
public void ForeColor_WellKnownBackgroundDataConfiguration_ReturnControlText() { // Setup var random = new Random(21); var wellKnownTileSource = random.NextEnumValue <WellKnownTileSource>(); BackgroundData backgroundData = BackgroundDataConverter.ConvertTo(new WellKnownTileSourceMapData(wellKnownTileSource)); using (var plugin = new RiskeerPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Color image = info.ForeColor(backgroundData); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), image); } }
public void ForeColor_HydraulicBoundaryDatabaseNotLinked_ReturnDisabledColor() { // Setup var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); var hydraulicBoundaryDatabaseContext = new HydraulicBoundaryDatabaseContext(assessmentSection.HydraulicBoundaryDatabase, assessmentSection); using (var plugin = new RiskeerPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Color color = info.ForeColor(hydraulicBoundaryDatabaseContext); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); } }
public void ForeColor_ContextHasReferenceLineWithoutGeometry_ReturnDisabledColor() { // Setup var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var referenceLineContext = new ReferenceLineContext(new ReferenceLine(), assessmentSection); using (var plugin = new RiskeerPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Color color = info.ForeColor(referenceLineContext); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); } mocks.VerifyAll(); }
public void ForeColor_NoSectionsOnFailureMechanism_ReturnGrayText() { // Setup var assessmentSection = mocks.Stub <IAssessmentSection>(); var failureMechanism = mocks.Stub <IFailureMechanism <FailureMechanismSectionResult> >(); failureMechanism.Stub(fm => fm.Sections).Return(Enumerable.Empty <FailureMechanismSection>()); mocks.ReplayAll(); var context = new FailureMechanismSectionsContext(failureMechanism, assessmentSection); using (var plugin = new RiskeerPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Color color = info.ForeColor(context); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); } mocks.VerifyAll(); }
public void ForeColor_NoSectionsOnFailureMechanism_ReturnGrayText() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new PipingFailureMechanism(); var context = new PipingFailureMechanismSectionsContext(failureMechanism, assessmentSection); using (var plugin = new PipingPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Color color = info.ForeColor(context); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); } mocks.VerifyAll(); }
public void ImplicitOperator_WithAllMethodsSet_InfoFullyConverted() { // Setup var onDropCounter = 0; var onNodeRenamedCounter = 0; var onNodeRemovedCounter = 0; var onNodeCheckedCounter = 0; var genericTreeNodeInfo = new TreeNodeInfo <int> { Text = o => "text", ForeColor = o => Color.Azure, Image = o => new Bitmap(16, 16), ContextMenuStrip = (o1, o2, tvc) => new ContextMenuStrip { Items = { new ToolStripButton() } }, EnsureVisibleOnCreate = (o, p) => true, ExpandOnCreate = o => true, ChildNodeObjects = o => new[] { new object() }, CanRename = (o1, o2) => true, OnNodeRenamed = (o, newName) => { onNodeRenamedCounter++; }, CanRemove = (o1, o2) => true, OnNodeRemoved = (o1, o2) => { onNodeRemovedCounter++; }, OnRemoveConfirmationText = o => "Confirmation message", OnRemoveChildNodesConfirmationText = o => "Confirmation message 2", CanCheck = o => true, CheckedState = o => TreeNodeCheckedState.Checked, OnNodeChecked = (o1, o2) => { onNodeCheckedCounter++; }, CanDrag = (o1, o2) => true, CanDrop = (o1, o2) => true, CanInsert = (o1, o2) => true, OnDrop = (o1, o2, o3, index, tvc) => { onDropCounter++; } }; // Precondition Assert.IsInstanceOf <TreeNodeInfo <int> >(genericTreeNodeInfo); // Call TreeNodeInfo treeNodeInfo = genericTreeNodeInfo; // Assert using (var treeViewControl = new TreeViewControl()) using (ContextMenuStrip contextMenuStrip = treeNodeInfo.ContextMenuStrip(0, 1, treeViewControl)) { Assert.AreEqual(1, contextMenuStrip.Items.Count); treeNodeInfo.OnDrop(0, 1, 2, 3, treeViewControl); Assert.AreEqual(1, onDropCounter); } Assert.AreEqual(typeof(int), treeNodeInfo.TagType); Assert.AreEqual("text", treeNodeInfo.Text(0)); Assert.AreEqual(Color.Azure, treeNodeInfo.ForeColor(0)); Assert.AreEqual(16, treeNodeInfo.Image(0).Height); Assert.IsTrue(treeNodeInfo.EnsureVisibleOnCreate(0, 1)); Assert.IsTrue(treeNodeInfo.ExpandOnCreate(0)); Assert.AreEqual(1, treeNodeInfo.ChildNodeObjects(0).Length); Assert.IsTrue(treeNodeInfo.CanRename(0, 1)); Assert.IsTrue(treeNodeInfo.CanRemove(0, 1)); Assert.AreEqual("Confirmation message", treeNodeInfo.OnRemoveConfirmationText(0)); Assert.AreEqual("Confirmation message 2", treeNodeInfo.OnRemoveChildNodesConfirmationText(0)); Assert.IsTrue(treeNodeInfo.CanCheck(0)); Assert.AreEqual(TreeNodeCheckedState.Checked, treeNodeInfo.CheckedState(0)); Assert.IsTrue(treeNodeInfo.CanDrag(0, 1)); Assert.IsTrue(treeNodeInfo.CanDrop(0, 1)); Assert.IsTrue(treeNodeInfo.CanInsert(0, 1)); treeNodeInfo.OnNodeRenamed(0, "newName"); Assert.AreEqual(1, onNodeRenamedCounter); treeNodeInfo.OnNodeRemoved(0, 1); Assert.AreEqual(1, onNodeRemovedCounter); treeNodeInfo.OnNodeChecked(0, 1); Assert.AreEqual(1, onNodeCheckedCounter); }