Beispiel #1
0
        public void Image_Always_ReturnsFailureMechanismIcon()
        {
            // Setup
            using (var plugin = new StabilityPointStructuresPlugin())
            {
                TreeNodeInfo info = GetInfo(plugin);

                // Call
                Image image = info.Image(null);

                // Assert
                TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.FailureMechanismIcon, image);
            }
        }
Beispiel #2
0
        public void Image_Always_ReturnsGeneralFolderIcon()
        {
            // Setup
            using (var plugin = new RiskeerPlugin())
            {
                TreeNodeInfo info = GetInfo(plugin);

                // Call
                Image image = info.Image(null);

                // Assert
                TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.GeneralFolderIcon, image);
            }
        }
        public void Image_Always_ReturnOutputIcon()
        {
            // Setup
            using (var plugin = new GrassCoverErosionOutwardsPlugin())
            {
                TreeNodeInfo info = GetInfo(plugin);

                // Call
                Image icon = info.Image(null);

                // Assert
                TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.GeneralOutputIcon, icon);
            }
        }
Beispiel #4
0
        public void Image_Always_ReturnsSetImage()
        {
            // Setup
            using (var plugin = new RiskeerPlugin())
            {
                TreeNodeInfo info = GetInfo(plugin);

                // Call
                Image image = info.Image(null);

                // Assert
                TestHelper.AssertImagesAreEqual(Resources.AssemblyResultTotal, image);
            }
        }
        public void Image_Always_ReturnOutputIcon()
        {
            // Setup
            using (var plugin = new WaveImpactAsphaltCoverPlugin())
            {
                TreeNodeInfo info = GetInfo(plugin);

                // Call
                Image icon = info.Image(null);

                // Assert
                TestHelper.AssertImagesAreEqual(Resources.GenericInputOutputIcon, icon);
            }
        }
        public void Image_Always_ReturnOutputIcon()
        {
            // Setup
            var output = new EmptyWaveImpactAsphaltCoverOutput();

            using (var plugin = new WaveImpactAsphaltCoverPlugin())
            {
                TreeNodeInfo info = GetInfo(plugin);
                // Call
                Image icon = info.Image(output);

                // Assert
                TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.GeneralOutputIcon, icon);
            }
        }
Beispiel #7
0
        public void Image_Always_ReturnFailureMechanismIcon()
        {
            // Setup
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
            var context          = new GrassCoverErosionOutwardsFailureMechanismContext(failureMechanism, assessmentSection);

            // Call
            Image icon = info.Image(context);

            // Assert
            TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.FailureMechanismIcon, icon);
        }
Beispiel #8
0
        public void Image_Always_ReturnsSetImage()
        {
            // Setup
            var backgroundData = new BackgroundData(new TestBackgroundDataConfiguration());

            using (var plugin = new RiskeerPlugin())
            {
                TreeNodeInfo info = GetInfo(plugin);

                // Call
                Image image = info.Image(backgroundData);

                // Assert
                TestHelper.AssertImagesAreEqual(Resources.Map, image);
            }
        }
        public void Image_Always_ReturnsSetImage()
        {
            // Setup
            var comment = new Comment();

            using (var plugin = new RiskeerPlugin())
            {
                TreeNodeInfo info = GetInfo(plugin);

                // Call
                Image image = info.Image(comment);

                // Assert
                TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.EditDocumentIcon, image);
            }
        }
        public void Image_Always_ReturnsSetImage()
        {
            // Setup
            var grassCoverErosionInwardsInputContext = new GrassCoverErosionInwardsInputContext(
                new GrassCoverErosionInwardsInput(),
                new GrassCoverErosionInwardsCalculation(),
                new GrassCoverErosionInwardsFailureMechanism(),
                mocksRepository.Stub <IAssessmentSection>());

            mocksRepository.ReplayAll();

            // Call
            Image image = info.Image(grassCoverErosionInwardsInputContext);

            // Assert
            TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.GenericInputOutputIcon, image);
        }
Beispiel #11
0
        public void Image_Always_ReturnsSetImage()
        {
            // Setup
            var stabilityPointStructuresInputContext = new StabilityPointStructuresInputContext(
                mocksRepository.Stub <StabilityPointStructuresInput>(),
                mocksRepository.Stub <StructuresCalculation <StabilityPointStructuresInput> >(),
                new StabilityPointStructuresFailureMechanism(),
                mocksRepository.Stub <IAssessmentSection>());

            mocksRepository.ReplayAll();

            // Call
            Image image = info.Image(stabilityPointStructuresInputContext);

            // Assert
            TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.GenericInputOutputIcon, image);
        }
Beispiel #12
0
        public void Image_Always_ReturnsSetImage()
        {
            // Setup
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var failureMechanism   = new PipingFailureMechanism();
            var surfaceLines       = new PipingSurfaceLineCollection();
            var pipingSurfaceLines = new PipingSurfaceLinesContext(surfaceLines, failureMechanism, assessmentSection);

            // Call
            Image image = info.Image(pipingSurfaceLines);

            // Assert
            TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.GeneralFolderIcon, image);
        }
Beispiel #13
0
        public void Image_Always_ReturnSectionsIcon()
        {
            // Setup
            mocks.ReplayAll();

            using (var plugin = new RiskeerPlugin())
            {
                TreeNodeInfo info = GetInfo(plugin);

                // Call
                Image image = info.Image(null);

                // Assert
                TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.SectionsIcon, image);
            }

            mocks.VerifyAll();
        }
        public void Image_Always_ReturnExpectedImage()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var group            = new CalculationGroup();
            var failureMechanism = new PipingFailureMechanism();
            var context          = new PipingScenariosContext(group, failureMechanism, assessmentSection);

            // Call
            Image image = info.Image(context);

            // Assert
            TestHelper.AssertImagesAreEqual(Resources.ScenariosIcon, image);
            mocks.VerifyAll();
        }
Beispiel #15
0
        public void Image_Always_ReturnsSetImage()
        {
            // Setup
            var pipingInputContext = new SemiProbabilisticPipingInputContext(
                new SemiProbabilisticPipingInput(),
                new SemiProbabilisticPipingCalculationScenario(),
                Enumerable.Empty <PipingSurfaceLine>(),
                Enumerable.Empty <PipingStochasticSoilModel>(),
                new PipingFailureMechanism(),
                mocks.Stub <IAssessmentSection>());

            mocks.ReplayAll();

            // Call
            Image image = info.Image(pipingInputContext);

            // Assert
            TestHelper.AssertImagesAreEqual(Resources.PipingInputIcon, image);
        }
Beispiel #16
0
        public void Image_Always_ReturnExpectedImage()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var failureMechanism = new ClosingStructuresFailureMechanism();

            var closingStructuresContext = new ClosingStructuresContext(failureMechanism.ClosingStructures, failureMechanism, assessmentSection);

            // Call
            Image image = info.Image(closingStructuresContext);

            // Assert
            TestHelper.AssertImagesAreEqual(Resources.GeneralFolderIcon, image);
            mocks.VerifyAll();
        }
Beispiel #17
0
        public void Image_Always_ReturnsSetImage()
        {
            // Setup
            var assessmentSection = mocksRepository.Stub <IAssessmentSection>();

            mocksRepository.ReplayAll();

            var heightStructuresCalculation  = new StructuresCalculation <HeightStructuresInput>();
            var heightStructuresInputContext = new HeightStructuresInputContext(
                heightStructuresCalculation.InputParameters,
                heightStructuresCalculation,
                new HeightStructuresFailureMechanism(),
                assessmentSection);

            // Call
            Image image = info.Image(heightStructuresInputContext);

            // Assert
            TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.GenericInputOutputIcon, image);
        }
Beispiel #18
0
        public void Image_TreeFolderOfCategoryOutput_ReturnsOutputFolderIcon()
        {
            // Setup
            mocks.ReplayAll();

            var categoryTreeFolder = new CategoryTreeFolder("", new object[0], TreeFolderCategory.Output);

            using (var plugin = new RiskeerPlugin())
            {
                TreeNodeInfo info = GetInfo(plugin);

                // Call
                Image image = info.Image(categoryTreeFolder);

                // Assert
                TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.OutputFolderIcon, image);
            }

            mocks.VerifyAll();
        }
Beispiel #19
0
        public void Image_Always_ReturnsSetImage()
        {
            // Setup
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var failureMechanism = new PipingFailureMechanism();

            var stochasticSoilModelCollectionContext = new PipingStochasticSoilModelCollectionContext(
                failureMechanism.StochasticSoilModels,
                failureMechanism,
                assessmentSection);

            // Call
            Image image = info.Image(stochasticSoilModelCollectionContext);

            // Assert
            TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.GeneralFolderIcon, image);
        }
        public void Image_Always_ReturnsSetImage()
        {
            // Setup
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var context = new ReferenceLineContext(new ReferenceLine(), assessmentSection);

            using (var plugin = new RiskeerPlugin())
            {
                TreeNodeInfo info = GetInfo(plugin);

                // Call
                Image image = info.Image(context);

                // Assert
                TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.ReferenceLineIcon, image);
            }

            mocks.VerifyAll();
        }
Beispiel #21
0
        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);
        }