Exemple #1
0
        public void Text_Always_ReturnExpectedText()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var failureMechanism = new StabilityPointStructuresFailureMechanism();
            var context          = new StabilityPointStructuresContext(failureMechanism.StabilityPointStructures,
                                                                       failureMechanism,
                                                                       assessmentSection);

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

                // Call
                string text = info.Text(context);

                // Assert
                const string expectedText = "Kunstwerken";
                Assert.AreEqual(expectedText, text);
            }

            mocks.VerifyAll();
        }
        public void Initialized_Always_ExpectedPropertiesSet()
        {
            // Setup
            using (var plugin = new StabilityPointStructuresPlugin())
            {
                TreeNodeInfo info = GetInfo(plugin);

                // Assert
                Assert.IsNotNull(info.Text);
                Assert.IsNull(info.ForeColor);
                Assert.IsNotNull(info.Image);
                Assert.IsNotNull(info.ContextMenuStrip);
                Assert.IsNull(info.EnsureVisibleOnCreate);
                Assert.IsNull(info.ExpandOnCreate);
                Assert.IsNull(info.ChildNodeObjects);
                Assert.IsNull(info.CanRename);
                Assert.IsNull(info.OnNodeRenamed);
                Assert.IsNull(info.CanRemove);
                Assert.IsNull(info.OnNodeRemoved);
                Assert.IsNull(info.CanCheck);
                Assert.IsNull(info.CheckedState);
                Assert.IsNull(info.OnNodeChecked);
                Assert.IsNull(info.CanDrag);
                Assert.IsNull(info.CanDrop);
                Assert.IsNull(info.CanInsert);
                Assert.IsNull(info.OnDrop);
            }
        }
Exemple #3
0
        public void Image_Always_ReturnExpectedImage()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            mocks.ReplayAll();

            var failureMechanism = new StabilityPointStructuresFailureMechanism();
            var context          = new StabilityPointStructuresContext(failureMechanism.StabilityPointStructures,
                                                                       failureMechanism,
                                                                       assessmentSection);

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

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

                // Assert
                TestHelper.AssertImagesAreEqual(RiskeerCommonFormsProperties.GeneralFolderIcon, image);
            }

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

            mocks.ReplayAll();

            var failureMechanism = new StabilityPointStructuresFailureMechanism();

            string sourcePath = TestHelper.GetScratchPadPath();

            failureMechanism.SetSections(Enumerable.Empty <FailureMechanismSection>(), sourcePath);
            var context = new StabilityPointStructuresFailureMechanismSectionsContext(failureMechanism, assessmentSection);

            using (var plugin = new StabilityPointStructuresPlugin())
            {
                UpdateInfo importInfo = GetUpdateInfo(plugin);

                // Call
                bool isEnabled = importInfo.IsEnabled(context);

                // Assert
                Assert.IsTrue(isEnabled);
            }

            mocks.VerifyAll();
        }
Exemple #5
0
        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 GetExportInfos_ReturnsSupportedExportInfos()
        {
            // Setup
            var mocks      = new MockRepository();
            var mainWindow = mocks.Stub <IMainWindow>();
            var gui        = mocks.Stub <IGui>();

            gui.Stub(g => g.MainWindow).Return(mainWindow);
            mocks.ReplayAll();

            using (var plugin = new StabilityPointStructuresPlugin
            {
                Gui = gui
            })
            {
                // Call
                ExportInfo[] exportInfos = plugin.GetExportInfos().ToArray();

                // Assert
                Assert.AreEqual(2, exportInfos.Length);
                Assert.IsTrue(exportInfos.Any(tni => tni.DataType == typeof(StabilityPointStructuresCalculationGroupContext)));
                Assert.IsTrue(exportInfos.Any(tni => tni.DataType == typeof(StabilityPointStructuresCalculationScenarioContext)));
            }

            mocks.VerifyAll();
        }
        public void ContextMenuStrip_Always_CallsBuilderMethods()
        {
            // Setup
            var mocksRepository = new MockRepository();

            var menuBuilder = mocksRepository.StrictMock <IContextMenuBuilder>();

            using (mocksRepository.Ordered())
            {
                menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
                menuBuilder.Expect(mb => mb.Build()).Return(null);
            }

            using (var plugin = new StabilityPointStructuresPlugin())
                using (var treeViewControl = new TreeViewControl())
                {
                    var gui = mocksRepository.Stub <IGui>();
                    gui.Stub(g => g.Get(null, treeViewControl)).Return(menuBuilder);
                    mocksRepository.ReplayAll();

                    plugin.Gui = gui;

                    TreeNodeInfo info = GetInfo(plugin);

                    // Call
                    info.ContextMenuStrip(null, null, treeViewControl);
                }

            // Assert
            mocksRepository.VerifyAll();
        }
Exemple #8
0
        public void VerifyUpdates_CalculationWithoutOutputs_ReturnsTrue()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();
            var mainWindow        = mocks.Stub <IMainWindow>();
            var gui = mocks.Stub <IGui>();

            gui.Stub(g => g.MainWindow).Return(mainWindow);
            mocks.ReplayAll();

            var failureMechanism = new StabilityPointStructuresFailureMechanism();

            failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation <StabilityPointStructuresInput>());

            var structures = new StructureCollection <StabilityPointStructure>();
            var context    = new StabilityPointStructuresContext(structures, failureMechanism, assessmentSection);

            using (var plugin = new StabilityPointStructuresPlugin())
            {
                plugin.Gui = gui;

                ImportInfo importInfo = GetImportInfo(plugin);

                // Call
                bool updatesVerified = importInfo.VerifyUpdates(context);

                // Assert
                Assert.IsTrue(updatesVerified);
                mocks.VerifyAll();
            }
        }
Exemple #9
0
        public void CreateFileImporter_Always_ReturnFileImporter()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine());
            mocks.ReplayAll();

            var failureMechanism = new StabilityPointStructuresFailureMechanism();

            var importTarget = new StabilityPointStructuresContext(failureMechanism.StabilityPointStructures,
                                                                   failureMechanism,
                                                                   assessmentSection);

            using (var plugin = new StabilityPointStructuresPlugin())
            {
                ImportInfo importInfo = GetImportInfo(plugin);

                // Call
                IFileImporter importer = importInfo.CreateFileImporter(importTarget, "test");

                // Assert
                Assert.IsInstanceOf <StabilityPointStructuresImporter>(importer);
            }

            mocks.VerifyAll();
        }
Exemple #10
0
        public void IsEnabled_ReferenceLineWithoutGeometry_ReturnFalse()
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();

            assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine());
            mocks.ReplayAll();

            var failureMechanism = new StabilityPointStructuresFailureMechanism();

            var context = new StabilityPointStructuresContext(failureMechanism.StabilityPointStructures,
                                                              failureMechanism,
                                                              assessmentSection);

            using (var plugin = new StabilityPointStructuresPlugin())
            {
                ImportInfo importInfo = GetImportInfo(plugin);

                // Call
                bool isEnabled = importInfo.IsEnabled(context);

                // Assert
                Assert.IsFalse(isEnabled);
            }

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

            mocks.ReplayAll();

            var failureMechanism = new StabilityPointStructuresFailureMechanism();

            string sourcePath = TestHelper.GetScratchPadPath();

            failureMechanism.SetSections(Enumerable.Empty <FailureMechanismSection>(), sourcePath);
            var context = new StabilityPointStructuresFailureMechanismSectionsContext(failureMechanism, assessmentSection);

            using (var plugin = new StabilityPointStructuresPlugin())
            {
                UpdateInfo updateInfo = GetUpdateInfo(plugin);

                // Call
                string currentFilePath = updateInfo.CurrentPath(context);

                // Assert
                Assert.AreEqual(sourcePath, currentFilePath);
                mocks.VerifyAll();
            }
        }
        public void GetViewInfos_ReturnsSupportedViewInfos()
        {
            // Setup
            const string symbol     = "<symbol>";
            var          fontFamily = new FontFamily();

            var mockRepository = new MockRepository();
            var gui            = mockRepository.Stub <IGui>();

            gui.Stub(g => g.ActiveStateInfo).Return(new StateInfo(string.Empty, symbol, fontFamily, p => p));
            mockRepository.ReplayAll();

            using (var plugin = new StabilityPointStructuresPlugin
            {
                Gui = gui
            })
            {
                // Call
                ViewInfo[] viewInfos = plugin.GetViewInfos().ToArray();

                // Assert
                Assert.AreEqual(5, viewInfos.Length);

                PluginTestHelper.AssertViewInfoDefined(
                    viewInfos,
                    typeof(CalculationsStateFailureMechanismContext),
                    typeof(CalculationsStateFailureMechanismView));

                PluginTestHelper.AssertViewInfoDefined(
                    viewInfos,
                    typeof(RegistrationStateFailureMechanismContext),
                    typeof(RegistrationStateFailureMechanismView));

                PluginTestHelper.AssertViewInfoDefined(
                    viewInfos,
                    typeof(StabilityPointStructuresFailureMechanismSectionResultContext),
                    typeof(IObservableEnumerable <AdoptableFailureMechanismSectionResult>),
                    typeof(StructuresFailureMechanismResultView <StabilityPointStructuresFailureMechanism, StabilityPointStructuresInput>));

                PluginTestHelper.AssertViewInfoDefined(
                    viewInfos,
                    typeof(StabilityPointStructuresScenariosContext),
                    typeof(CalculationGroup),
                    typeof(StabilityPointStructuresScenariosView));

                PluginTestHelper.AssertViewInfoDefined(
                    viewInfos,
                    typeof(StabilityPointStructuresCalculationGroupContext),
                    typeof(CalculationGroup),
                    typeof(StabilityPointStructuresCalculationsView));

                viewInfos.ForEachElementDo(vi =>
                {
                    Assert.AreEqual(symbol, vi.GetSymbol());
                    Assert.AreSame(fontFamily, vi.GetFontFamily());
                });
            }

            mockRepository.VerifyAll();
        }
Exemple #13
0
        public void CreateFileImporter_Always_ReturnFileImporter()
        {
            // Setup
            var mocks = new MockRepository();
            IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocks);

            mocks.ReplayAll();

            var context = new StabilityPointStructuresCalculationGroupContext(new CalculationGroup(),
                                                                              null,
                                                                              new StabilityPointStructuresFailureMechanism(),
                                                                              assessmentSection);

            using (var plugin = new StabilityPointStructuresPlugin())
            {
                ImportInfo info = GetImportInfo(plugin);

                // Call
                IFileImporter fileImporter = info.CreateFileImporter(context, "test");

                // Assert
                Assert.IsInstanceOf <StabilityPointStructuresCalculationConfigurationImporter>(fileImporter);
            }

            mocks.VerifyAll();
        }
 public void DefaultConstructor_ExpectedValues()
 {
     // Call
     using (var plugin = new StabilityPointStructuresPlugin())
     {
         // Assert
         Assert.IsInstanceOf <PluginBase>(plugin);
     }
 }
Exemple #15
0
        public void ContextMenuStrip_WithContext_AddCustomItems()
        {
            // Setup
            using (var plugin = new StabilityPointStructuresPlugin())
                using (var treeView = new TreeViewControl())
                {
                    var assessmentSection = mocksRepository.Stub <IAssessmentSection>();
                    var failureMechanism  = new StabilityPointStructuresFailureMechanism();
                    var context           = new StabilityPointStructuresFailureMechanismContext(failureMechanism, assessmentSection);
                    var menuBuilder       = new CustomItemsOnlyContextMenuBuilder();

                    var gui = mocksRepository.Stub <IGui>();
                    gui.Stub(cmp => cmp.Get(context, treeView)).Return(menuBuilder);
                    gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
                    gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
                    gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub <IMainWindow>());
                    mocksRepository.ReplayAll();

                    plugin.Gui = gui;

                    TreeNodeInfo info = GetInfo(plugin);

                    // Call
                    using (ContextMenuStrip menu = info.ContextMenuStrip(context, assessmentSection, treeView))
                    {
                        // Assert
                        Assert.AreEqual(12, menu.Items.Count);

                        TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndex,
                                                                      "Alles &valideren",
                                                                      "Er zijn geen berekeningen om te valideren.",
                                                                      RiskeerCommonFormsResources.ValidateAllIcon,
                                                                      false);

                        TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex,
                                                                      "Alles be&rekenen",
                                                                      "Er zijn geen berekeningen om uit te voeren.",
                                                                      RiskeerCommonFormsResources.CalculateAllIcon,
                                                                      false);

                        TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuClearAllIndex,
                                                                      "&Wis alle uitvoer...",
                                                                      "Er zijn geen berekeningen met uitvoer om te wissen.",
                                                                      RiskeerCommonFormsResources.ClearIcon,
                                                                      false);
                        TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuClearIllustrationPointsIndex,
                                                                      "Wis alle illustratiepunten...",
                                                                      "Er zijn geen berekeningen met illustratiepunten om te wissen.",
                                                                      RiskeerCommonFormsResources.ClearIllustrationPointsIcon,
                                                                      false);
                    }
                }

            mocksRepository.VerifyAll();
        }
Exemple #16
0
        public void VerifyUpdates_CalculationWithOutputs_AlwaysReturnsExpectedInquiryMessage(bool isActionConfirmed)
        {
            // Setup
            var mocks             = new MockRepository();
            var assessmentSection = mocks.Stub <IAssessmentSection>();
            var mainWindow        = mocks.Stub <IMainWindow>();
            var gui = mocks.Stub <IGui>();

            gui.Stub(g => g.MainWindow).Return(mainWindow);
            mocks.ReplayAll();

            var failureMechanism = new StabilityPointStructuresFailureMechanism();

            failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation <StabilityPointStructuresInput>
            {
                Output = new TestStructuresOutput()
            });

            var structures = new StructureCollection <StabilityPointStructure>();
            var context    = new StabilityPointStructuresContext(structures, failureMechanism, assessmentSection);

            string textBoxMessage = null;

            DialogBoxHandler = (name, wnd) =>
            {
                var helper = new MessageBoxTester(wnd);
                textBoxMessage = helper.Text;

                if (isActionConfirmed)
                {
                    helper.ClickOk();
                }
                else
                {
                    helper.ClickCancel();
                }
            };

            using (var plugin = new StabilityPointStructuresPlugin())
            {
                plugin.Gui = gui;
                ImportInfo importInfo = GetImportInfo(plugin);

                // Call
                bool updatesVerified = importInfo.VerifyUpdates(context);

                // Assert
                string expectedInquiryMessage = "Als u kunstwerken importeert, dan worden alle rekenresultaten van dit faalmechanisme verwijderd." +
                                                $"{Environment.NewLine}{Environment.NewLine}Weet u zeker dat u wilt doorgaan?";
                Assert.AreEqual(expectedInquiryMessage, textBoxMessage);
                Assert.AreEqual(isActionConfirmed, updatesVerified);
                mocks.VerifyAll();
            }
        }
Exemple #17
0
        public void ContextMenuStrip_FailureMechanismWithCalculationsContainingIllustrationPoints_ContextMenuItemClearIllustrationPointsEnabled()
        {
            // Setup
            var calculationWithIllustrationPoints = new TestStabilityPointStructuresCalculationScenario
            {
                Output = new TestStructuresOutput(new TestGeneralResultFaultTreeIllustrationPoint())
            };

            var calculationWithOutput = new TestStabilityPointStructuresCalculationScenario
            {
                Output = new TestStructuresOutput()
            };

            var failureMechanism = new StabilityPointStructuresFailureMechanism
            {
                CalculationsGroup =
                {
                    Children =
                    {
                        calculationWithIllustrationPoints,
                        calculationWithOutput,
                        new TestStabilityPointStructuresCalculationScenario()
                    }
                }
            };

            IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocksRepository, "invalidFilePath");

            var nodeData    = new StabilityPointStructuresFailureMechanismContext(failureMechanism, assessmentSection);
            var menuBuilder = new CustomItemsOnlyContextMenuBuilder();

            using (var plugin = new StabilityPointStructuresPlugin())
                using (var treeViewControl = new TreeViewControl())
                {
                    var gui = mocksRepository.Stub <IGui>();
                    gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder);
                    gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub <IMainWindow>());
                    mocksRepository.ReplayAll();

                    plugin.Gui = gui;

                    TreeNodeInfo info = GetInfo(plugin);

                    using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
                    {
                        // Call
                        ToolStripItem toolStripItem = contextMenu.Items[contextMenuClearIllustrationPointsIndex];

                        // Assert
                        Assert.IsTrue(toolStripItem.Enabled);
                    }
                }
        }
        public void GetUpdateInfos_ReturnSupportedUpdateInfos()
        {
            using (var plugin = new StabilityPointStructuresPlugin())
            {
                // Call
                UpdateInfo[] updateInfo = plugin.GetUpdateInfos().ToArray();

                // Assert
                Assert.AreEqual(2, updateInfo.Length);
                Assert.IsTrue(updateInfo.Any(i => i.DataType == typeof(StabilityPointStructuresContext)));
                Assert.IsTrue(updateInfo.Any(i => i.DataType == typeof(StabilityPointStructuresFailureMechanismSectionsContext)));
            }
        }
        public void Image_Always_ReturnExpectedIcon()
        {
            // Setup
            using (var plugin = new StabilityPointStructuresPlugin())
            {
                UpdateInfo importInfo = GetUpdateInfo(plugin);

                // Call
                Image image = importInfo.Image;

                // Assert
                TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.SectionsIcon, image);
            }
        }
        public void Category_Always_ReturnExpectedCategory()
        {
            // Setup
            using (var plugin = new StabilityPointStructuresPlugin())
            {
                UpdateInfo importInfo = GetUpdateInfo(plugin);

                // Call
                string category = importInfo.Category;

                // Assert
                Assert.AreEqual("Algemeen", category);
            }
        }
        public void Name_Always_ReturnExpectedName()
        {
            // Setup
            using (var plugin = new StabilityPointStructuresPlugin())
            {
                UpdateInfo importInfo = GetUpdateInfo(plugin);

                // Call
                string name = importInfo.Name;

                // Assert
                Assert.AreEqual("Vakindeling", name);
            }
        }
        public void FileFilterGenerator_Always_ReturnExpectedFileFilter()
        {
            // Setup
            using (var plugin = new StabilityPointStructuresPlugin())
            {
                UpdateInfo importInfo = GetUpdateInfo(plugin);

                // Call
                FileFilterGenerator fileFilterGenerator = importInfo.FileFilterGenerator;

                // Assert
                Assert.AreEqual("Shapebestand (*.shp)|*.shp", fileFilterGenerator.Filter);
            }
        }
Exemple #23
0
        public void Name_Always_ReturnExpectedName()
        {
            // Setup
            using (var plugin = new StabilityPointStructuresPlugin())
            {
                ImportInfo importInfo = GetImportInfo(plugin);

                // Call
                string name = importInfo.Name;

                // Assert
                Assert.AreEqual("Kunstwerklocaties", name);
            }
        }
Exemple #24
0
        public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemCalculateAllAndValidateAllEnabled()
        {
            // Setup
            var failureMechanism = new StabilityPointStructuresFailureMechanism();

            failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation <StabilityPointStructuresInput>());

            string validFilePath             = Path.Combine(testDataPath, "complete.sqlite");
            var    hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
            {
                FilePath = validFilePath,
                Version  = "1.0"
            };

            HydraulicBoundaryDatabaseTestHelper.SetHydraulicBoundaryLocationConfigurationSettings(hydraulicBoundaryDatabase);

            var assessmentSection = mocksRepository.Stub <IAssessmentSection>();

            assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(hydraulicBoundaryDatabase);

            var nodeData    = new StabilityPointStructuresFailureMechanismContext(failureMechanism, assessmentSection);
            var menuBuilder = new CustomItemsOnlyContextMenuBuilder();

            using (var plugin = new StabilityPointStructuresPlugin())
                using (var treeViewControl = new TreeViewControl())
                {
                    var gui = mocksRepository.Stub <IGui>();
                    gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder);
                    gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub <IMainWindow>());
                    mocksRepository.ReplayAll();

                    TreeNodeInfo info = GetInfo(plugin);
                    plugin.Gui = gui;

                    // Call
                    using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl))
                    {
                        // Assert
                        TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex,
                                                                      "Alles be&rekenen",
                                                                      "Voer alle berekeningen binnen dit faalmechanisme uit.",
                                                                      RiskeerCommonFormsResources.CalculateAllIcon);

                        TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndex,
                                                                      "Alles &valideren",
                                                                      "Valideer alle berekeningen binnen dit faalmechanisme.",
                                                                      RiskeerCommonFormsResources.ValidateAllIcon);
                    }
                }
        }
Exemple #25
0
        public void IsEnabled_Always_ReturnsTrue()
        {
            // Setup
            using (var plugin = new StabilityPointStructuresPlugin())
            {
                ImportInfo info = GetImportInfo(plugin);

                // Call
                bool isEnabled = info.IsEnabled(null);

                // Assert
                Assert.IsTrue(isEnabled);
            }
        }
        public void Image_Always_ReturnStructureIcon()
        {
            // Setup
            using (var plugin = new StabilityPointStructuresPlugin())
            {
                TreeNodeInfo info = GetInfo(plugin);

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

                // Assert
                TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.StructuresIcon, image);
            }
        }
        public void GetImportInfos_ReturnsSupportedImportInfos()
        {
            // Setup
            using (var plugin = new StabilityPointStructuresPlugin())
            {
                // Call
                ImportInfo[] importInfos = plugin.GetImportInfos().ToArray();

                // Assert
                Assert.AreEqual(2, importInfos.Length);
                Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(StabilityPointStructuresContext)));
                Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(StabilityPointStructuresCalculationGroupContext)));
            }
        }
Exemple #28
0
        public void FileFilterGenerator_Always_ReturnFileFilter()
        {
            // Setup
            using (var plugin = new StabilityPointStructuresPlugin())
            {
                ImportInfo info = GetImportInfo(plugin);

                // Call
                FileFilterGenerator fileFilterGenerator = info.FileFilterGenerator;

                // Assert
                Assert.AreEqual("Riskeer berekeningenconfiguratie (*.xml)|*.xml", fileFilterGenerator.Filter);
            }
        }
Exemple #29
0
        public void SetUp()
        {
            mocks = new MockRepository();
            var mainWindow = mocks.Stub <IMainWindow>();
            var gui        = mocks.Stub <IGui>();

            gui.Stub(g => g.MainWindow).Return(mainWindow);
            mocks.Replay(gui);
            mocks.Replay(mainWindow);

            plugin = new StabilityPointStructuresPlugin
            {
                Gui = gui
            };

            info = plugin.GetExportInfos().First(ei => ei.DataType == typeof(StabilityPointStructuresCalculationScenarioContext));
        }
Exemple #30
0
        public void Initialized_Always_ExpectedPropertiesSet()
        {
            // Setup
            using (var plugin = new StabilityPointStructuresPlugin())
            {
                // Call
                ImportInfo info = GetImportInfo(plugin);

                // Assert
                Assert.IsNotNull(info.CreateFileImporter);
                Assert.IsNotNull(info.IsEnabled);
                Assert.AreEqual("Riskeer berekeningenconfiguratie", info.Name);
                Assert.AreEqual("Algemeen", info.Category);
                TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.GeneralFolderIcon, info.Image);
                Assert.IsNotNull(info.FileFilterGenerator);
            }
        }