public void ClearAllSections_HasSections_ClearSectionsAndSectionResultsAndSourcePath() { // Setup var section = new FailureMechanismSection("A", new[] { new Point2D(1.1, 2.2), new Point2D(3.3, 4.4) }); var failureMechanism = new SpecificFailureMechanism(); const string sourcePath = "some/Path"; failureMechanism.SetSections(new[] { section }, sourcePath); // Precondition Assert.AreEqual(sourcePath, failureMechanism.FailureMechanismSectionSourcePath); CollectionAssert.IsNotEmpty(failureMechanism.Sections); CollectionAssert.IsNotEmpty(failureMechanism.SectionResults); // Call failureMechanism.ClearAllSections(); // Assert Assert.IsNull(failureMechanism.FailureMechanismSectionSourcePath); CollectionAssert.IsEmpty(failureMechanism.Sections); CollectionAssert.IsEmpty(failureMechanism.SectionResults); }
public void GivenFormWithAssemblyResultTotalView_WhenSpecificFailureMechanismNotifiesObservers_ThenRefreshButtonEnabledAndWarningSet() { // Given var failureMechanism = new SpecificFailureMechanism(); AssessmentSection assessmentSection = CreateAssessmentSection(); assessmentSection.SpecificFailureMechanisms.Add(failureMechanism); using (AssemblyResultTotalView view = ShowAssemblyResultTotalView(assessmentSection)) { // Precondition ButtonTester buttonTester = GetRefreshAssemblyResultButtonTester(); Button button = buttonTester.Properties; Assert.IsFalse(button.Enabled); ErrorProvider warningProvider = GetWarningProvider(view); Assert.IsEmpty(warningProvider.GetError(button)); // When failureMechanism.NotifyObservers(); // Then Assert.IsTrue(buttonTester.Properties.Enabled); Assert.AreEqual(assemblyResultOutdatedWarning, warningProvider.GetError(button)); } }
public void GivenAssessmentSectionResultObserverWithAttachedObserver_WhenSpecificFailureMechanismRemovedAndNotified_ThenAttachedObserverNotNotified() { // Given var failureMechanismToRemove = new SpecificFailureMechanism(); AssessmentSection assessmentSection = CreateAssessmentSection(); assessmentSection.SpecificFailureMechanisms.AddRange(new[] { failureMechanismToRemove, new SpecificFailureMechanism() }); using (var resultObserver = new AssessmentSectionResultObserver(assessmentSection)) { var mocks = new MockRepository(); var observer = mocks.StrictMock <IObserver>(); mocks.ReplayAll(); assessmentSection.SpecificFailureMechanisms.Remove(failureMechanismToRemove); assessmentSection.SpecificFailureMechanisms.NotifyObservers(); resultObserver.Attach(observer); // When failureMechanismToRemove.NotifyObservers(); // Then mocks.VerifyAll(); } }
public void CloseForData_ViewDataIsFailureMechanismCommentOfDeletedAssessmentSection_ReturnTrue(Func <SpecificFailureMechanism, Comment> getCommentFunc) { // Setup var failureMechanism = new SpecificFailureMechanism(); var assessmentSection = mocks.Stub <IAssessmentSection>(); assessmentSection.Stub(s => s.GetFailureMechanisms()).Return(Enumerable.Empty <IFailureMechanism>()); assessmentSection.Stub(s => s.SpecificFailureMechanisms).Return(new ObservableList <SpecificFailureMechanism> { failureMechanism }); assessmentSection.Stub(s => s.Comments).Return(new Comment()); mocks.ReplayAll(); using (var view = new CommentView { Data = getCommentFunc(failureMechanism) }) { // Call bool closeForData = info.CloseForData(view, assessmentSection); // Assert Assert.IsTrue(closeForData); } mocks.VerifyAll(); }
public void OnDrop_DataDroppedToDifferentIndex_DroppedDataCorrectlyMovedAndObserversNotified() { // Setup var observer = mocks.StrictMock <IObserver>(); observer.Expect(o => o.UpdateObserver()); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var unmovedFailureMechanism = new SpecificFailureMechanism(); var movedFailureMechanism = new SpecificFailureMechanism(); var failureMechanisms = new ObservableList <SpecificFailureMechanism> { unmovedFailureMechanism, movedFailureMechanism }; failureMechanisms.Attach(observer); var parentData = new SpecificFailureMechanismsContext(failureMechanisms, assessmentSection); var draggedData = new SpecificFailureMechanismContext(movedFailureMechanism, assessmentSection); // Call info.OnDrop(draggedData, parentData, parentData, 0, null); // Assert CollectionAssert.AreEqual(new[] { movedFailureMechanism, unmovedFailureMechanism }, failureMechanisms); }
public void GivenSpecificFailureMechanismWithoutSections_WhenSettingValidSections_ThenExpectedSectionsAndSourcePathAndSectionResultsSet() { // Given const string sourcePath = "some/Path"; var failureMechanism = new SpecificFailureMechanism(); const int matchingX = 1; const int matchingY = 2; var section1 = new FailureMechanismSection("A", new[] { new Point2D(3, 4), new Point2D(matchingX, matchingY) }); var section2 = new FailureMechanismSection("B", new[] { new Point2D(matchingX, matchingY), new Point2D(-2, -1) }); FailureMechanismSection[] sections = { section1, section2 }; // When failureMechanism.SetSections(sections, sourcePath); // Then Assert.AreEqual(sourcePath, failureMechanism.FailureMechanismSectionSourcePath); CollectionAssert.AreEqual(sections, failureMechanism.Sections); Assert.AreEqual(sections.Length, failureMechanism.SectionResults.Count()); CollectionAssert.AreEqual(sections, failureMechanism.SectionResults.Select(sr => sr.Section)); }
public void GivenFormWithAssemblyResultTotalView_WhenSpecificFailureMechanismRemovedAndRefreshingAssemblyResults_ThenDataGridViewDataSourceAndRowsUpdated() { // Given AssessmentSection assessmentSection = CreateAssessmentSection(); using (new AssemblyToolCalculatorFactoryConfig()) using (AssemblyResultTotalView view = ShowAssemblyResultTotalView(assessmentSection)) { var calculatorFactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; DataGridView dataGridView = GetDataGridView(); object dataSource = dataGridView.DataSource; // Precondition DataGridViewRowCollection rows = dataGridView.Rows; AssertFailureMechanismRows(view.AssessmentSection, calculator.AssemblyResultOutput.AssemblyResult, rows); // When ObservableList <SpecificFailureMechanism> specificFailureMechanisms = assessmentSection.SpecificFailureMechanisms; SpecificFailureMechanism failureMechanismToRemove = specificFailureMechanisms.Last(); specificFailureMechanisms.Remove(failureMechanismToRemove); specificFailureMechanisms.NotifyObservers(); ButtonTester buttonTester = GetRefreshAssemblyResultButtonTester(); buttonTester.Click(); // Then Assert.AreNotSame(dataSource, dataGridView.DataSource); AssertFailureMechanismRows(view.AssessmentSection, calculator.AssemblyResultOutput.AssemblyResult, rows); } }
public void SetSections_SecondSectionEndConnectingToStartOfFirst_ThrowArgumentException() { // Setup var failureMechanism = new SpecificFailureMechanism(); const int matchingX = 1; const int matchingY = 2; var section1 = new FailureMechanismSection("A", new[] { new Point2D(matchingX, matchingY), new Point2D(3, 4) }); var section2 = new FailureMechanismSection("B", new[] { new Point2D(-2, -1), new Point2D(matchingX, matchingY) }); // Call void Call() => failureMechanism.SetSections(new[] { section1, section2 }, string.Empty); // Assert const string expectedMessage = "Vak 'B' sluit niet aan op de al gedefinieerde vakken van het faalmechanisme."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentException>(Call, expectedMessage); }
public void CloseForData_AssessmentSectionRemovedWithoutFailureMechanism_ReturnsFalse() { // Setup var assessmentSection = mocks.Stub <IAssessmentSection>(); assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(Array.Empty <IFailureMechanism>()); assessmentSection.Stub(asm => asm.SpecificFailureMechanisms).Return(new ObservableList <SpecificFailureMechanism>()); mocks.ReplayAll(); var failureMechanism = new SpecificFailureMechanism(); using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView <SpecificFailureMechanism>( failureMechanism.SectionResults, failureMechanism, assessmentSection, (fm, ass) => new FailureMechanismAssemblyResultWrapper(double.NaN, AssemblyMethod.Manual), fm => true, sr => FailureMechanismSectionAssemblyResultWrapperTestFactory.Create())) { // Call bool closeForData = info.CloseForData(view, assessmentSection); // Assert Assert.IsFalse(closeForData); } mocks.VerifyAll(); }
public void GivenFormWithAssemblyResultPerSectionView_WhenSpecificFailureMechanismRemoved_ThenColumnRemoved() { // Given var random = new Random(21); AssessmentSection assessmentSection = TestDataGenerator.GetAssessmentSectionWithAllFailureMechanismSectionsAndResults( random.NextEnumValue <AssessmentSectionComposition>()); using (new AssemblyToolCalculatorFactoryConfig()) using (ShowAssemblyResultPerSectionView(assessmentSection)) { // Precondition DataGridView dataGridView = GetDataGridView(); DataGridViewColumnCollection dataGridViewColumns = dataGridView.Columns; AssertColumns(dataGridViewColumns, GetExpectedNrOfColumns(assessmentSection), assessmentSection.SpecificFailureMechanisms); ButtonTester buttonTester = GetRefreshAssemblyResultButtonTester(); // When SpecificFailureMechanism failureMechanismToRemove = assessmentSection.SpecificFailureMechanisms.First(); assessmentSection.SpecificFailureMechanisms.Remove(failureMechanismToRemove); assessmentSection.NotifyObservers(); buttonTester.Click(); // Then AssertColumns(dataGridViewColumns, GetExpectedNrOfColumns(assessmentSection), assessmentSection.SpecificFailureMechanisms); } }
public void CloseForData_ViewNotCorrespondingToRemovedFailureMechanismContext_ReturnsFalse() { // Setup var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new SpecificFailureMechanism(); var failureMechanismContext = new SpecificFailureMechanismContext(new SpecificFailureMechanism(), assessmentSection); using (var view = new NonAdoptableWithProfileProbabilityFailureMechanismResultView <SpecificFailureMechanism>( failureMechanism.SectionResults, failureMechanism, assessmentSection, (fm, ass) => new FailureMechanismAssemblyResultWrapper(double.NaN, AssemblyMethod.Manual), fm => true, sr => FailureMechanismSectionAssemblyResultWrapperTestFactory.Create())) { // Call bool closeForData = info.CloseForData(view, failureMechanismContext); // Assert Assert.IsFalse(closeForData); } mocks.VerifyAll(); }
public void ShouldCloseMethod_ViewCorrespondingToRemovedAssessmentSectionAndSpecificFailureMechanism_ReturnsTrue() { // Setup var specificFailureMechanism = new SpecificFailureMechanism(); var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); assessmentSection.Stub(asm => asm.GetFailureMechanisms()).Return(Enumerable.Empty <IFailureMechanism>()); assessmentSection.Stub(asm => asm.SpecificFailureMechanisms).Return(new ObservableList <SpecificFailureMechanism> { specificFailureMechanism }); mocks.ReplayAll(); using (IView view = GetView(specificFailureMechanism)) { // Call bool closeForData = ShouldCloseMethod(view, assessmentSection); // Assert Assert.IsTrue(closeForData); } mocks.VerifyAll(); }
public void OnNodeRemoved_WithContexts_RemovesFailureMechanismFromCollectionAndNotifiesObservers() { // Setup var assessmentSection = mocks.Stub <IAssessmentSection>(); var observer = mocks.StrictMock <IObserver>(); observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); var failureMechanism = new SpecificFailureMechanism(); var context = new SpecificFailureMechanismContext(failureMechanism, assessmentSection); var failureMechanisms = new ObservableList <SpecificFailureMechanism> { failureMechanism }; failureMechanisms.Attach(observer); var parentContext = new SpecificFailureMechanismsContext(failureMechanisms, assessmentSection); // Call info.OnNodeRemoved(context, parentContext); // Assert CollectionAssert.IsEmpty(failureMechanisms); }
public void Constructor_ExpectedValues() { // Setup var random = new Random(21); var failureMechanism = new SpecificFailureMechanism { InAssembly = random.NextBoolean(), GeneralInput = { ApplyLengthEffectInSection = random.NextBoolean() } }; // Call var properties = new SpecificFailureMechanismProperties(failureMechanism); // Assert Assert.IsInstanceOf <ObjectProperties <SpecificFailureMechanism> >(properties); Assert.AreEqual(failureMechanism.Name, properties.Name); Assert.AreEqual(failureMechanism.Code, properties.Code); Assert.AreEqual(failureMechanism.InAssembly, properties.InAssembly); GeneralInput input = failureMechanism.GeneralInput; Assert.AreEqual(2, properties.N.NumberOfDecimalPlaces); Assert.AreEqual(input.N, properties.N, properties.N.GetAccuracy()); Assert.AreEqual(input.ApplyLengthEffectInSection, properties.ApplyLengthEffectInSection); }
public void SetSections_SecondSectionDoesNotConnectToFirst_ThrowArgumentException() { // Setup var failureMechanism = new SpecificFailureMechanism(); var section1 = new FailureMechanismSection("A", new[] { new Point2D(1, 2), new Point2D(3, 4) }); var section2 = new FailureMechanismSection("B", new[] { new Point2D(5, 6), new Point2D(7, 8) }); // Call void Call() => failureMechanism.SetSections(new[] { section1, section2 }, string.Empty); // Assert const string expectedMessage = "Vak 'B' sluit niet aan op de al gedefinieerde vakken van het faalmechanisme."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentException>(Call, expectedMessage); }
public void GivenAssessmentSectionResultObserverWithAttachedObserver_WhenSpecificFailureMechanismInCollectionNotified_ThenAttachedObserverNotified() { // Given var specificFailureMechanism = new SpecificFailureMechanism(); AssessmentSection assessmentSection = CreateAssessmentSection(); assessmentSection.SpecificFailureMechanisms.Add(specificFailureMechanism); using (var resultObserver = new AssessmentSectionResultObserver(assessmentSection)) { var mocks = new MockRepository(); var observer = mocks.StrictMock <IObserver>(); observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); resultObserver.Attach(observer); // When specificFailureMechanism.NotifyObservers(); // Then mocks.VerifyAll(); } }
public void CurrentPath_FailureMechanismSectionsHasPathSet_ReturnsExpectedPath() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); const string expectedFilePath = "path"; var failureMechanism = new SpecificFailureMechanism(); failureMechanism.SetSections(Enumerable.Empty <FailureMechanismSection>(), expectedFilePath); var context = new SpecificFailureMechanismSectionsContext(failureMechanism, assessmentSection); using (var plugin = new RiskeerPlugin()) { UpdateInfo updateInfo = GetUpdateInfo(plugin); // Call string currentFilePath = updateInfo.CurrentPath(context); // Assert Assert.AreEqual(expectedFilePath, currentFilePath); mocks.VerifyAll(); } }
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 SpecificFailureMechanism(); var importTarget = new SpecificFailureMechanismSectionsContext(failureMechanism, assessmentSection); using (var plugin = new RiskeerPlugin()) { UpdateInfo updateInfo = GetUpdateInfo(plugin); // Call IFileImporter importer = updateInfo.CreateFileImporter(importTarget, "test"); // Assert Assert.IsInstanceOf <FailureMechanismSectionsImporter>(importer); } mocks.VerifyAll(); }
public void IsEnabled_SourcePathSet_ReturnTrue() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new SpecificFailureMechanism(); failureMechanism.SetSections(Enumerable.Empty <FailureMechanismSection>(), "path"); var context = new SpecificFailureMechanismSectionsContext(failureMechanism, assessmentSection); using (var plugin = new RiskeerPlugin()) { UpdateInfo updateInfo = GetUpdateInfo(plugin); // Call bool isEnabled = updateInfo.IsEnabled(context); // Assert Assert.IsTrue(isEnabled); } mocks.VerifyAll(); }
public void GivenViewWithSpecificFailureMechanismData_WhenFailureMechanismNameUpdatedAndNotified_ThenMapDataUpdatedAndObserversNotified() { // Given var mocks = new MockRepository(); var observer = mocks.StrictMock <IObserver>(); observer.Expect(obs => obs.UpdateObserver()); mocks.ReplayAll(); var assessmentSection = new AssessmentSectionStub(); var failureMechanism = new SpecificFailureMechanism(); SpecificFailureMechanismView view = CreateView(failureMechanism, assessmentSection); MapDataCollection mapData = view.Map.Data; mapData.Attach(observer); // Precondition Assert.AreEqual(failureMechanism.Name, mapData.Name); // When const string newFailureMechanismName = "New Failure Mechanism Name"; failureMechanism.Name = newFailureMechanismName; failureMechanism.NotifyObservers(); // Then Assert.AreEqual(newFailureMechanismName, mapData.Name); mocks.VerifyAll(); }
public void GivenFormWithAssemblyResultPerSectionView_WhenSpecificFailureMechanismAdded_ThenColumnAdded() { // Given var random = new Random(21); AssessmentSection assessmentSection = TestDataGenerator.GetAssessmentSectionWithAllFailureMechanismSectionsAndResults( random.NextEnumValue <AssessmentSectionComposition>()); using (new AssemblyToolCalculatorFactoryConfig()) using (ShowAssemblyResultPerSectionView(assessmentSection)) { var calculatorFactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance; AssessmentSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedAssessmentSectionAssemblyCalculator; // Precondition DataGridView dataGridView = GetDataGridView(); Assert.AreEqual(20, dataGridView.ColumnCount); ButtonTester buttonTester = GetRefreshAssemblyResultButtonTester(); // When const string testCode = "TestCode"; var failureMechanism = new SpecificFailureMechanism { Code = testCode }; assessmentSection.SpecificFailureMechanisms.Add(failureMechanism); assessmentSection.SpecificFailureMechanisms.NotifyObservers(); calculator.CombinedFailureMechanismSectionAssemblyOutput = null; buttonTester.Click(); // Then AssertColumns(dataGridView.Columns, GetExpectedNrOfColumns(assessmentSection), assessmentSection.SpecificFailureMechanisms); } }
/// <summary> /// Reads the <see cref="SpecificFailureMechanismEntity"/> and uses the information to create a <see cref="SpecificFailureMechanism"/>. /// </summary> /// <param name="entity">The <see cref="SpecificFailureMechanismEntity"/> to create a <see cref="SpecificFailureMechanism"/> with.</param> /// <param name="collector">The object keeping track of read operations.</param> /// <exception cref="ArgumentNullException">Thrown when any argument is <c>null</c>.</exception> internal static SpecificFailureMechanism Read(this SpecificFailureMechanismEntity entity, ReadConversionCollector collector) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } if (collector == null) { throw new ArgumentNullException(nameof(collector)); } var failureMechanism = new SpecificFailureMechanism { Name = entity.Name, Code = entity.Code, GeneralInput = { N = (RoundedDouble)entity.N, ApplyLengthEffectInSection = Convert.ToBoolean(entity.ApplyLengthEffectInSection) } }; entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); ReadFailureMechanismSectionResults(entity, failureMechanism, collector); return(failureMechanism); }
private SpecificFailureMechanismView CreateView(SpecificFailureMechanism failureMechanism, IAssessmentSection assessmentSection) { var view = new SpecificFailureMechanismView(failureMechanism, assessmentSection); testForm.Controls.Add(view); testForm.Show(); return(view); }
public void Constructor_InAssemblyTrue_PropertiesHaveExpectedAttributesValues() { // Setup var failureMechanism = new SpecificFailureMechanism { InAssembly = true }; // Call var properties = new SpecificFailureMechanismProperties(failureMechanism); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(5, dynamicProperties.Count); const string generalCategory = "Algemeen"; const string lengthEffectCategory = "Lengte-effect"; PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, generalCategory, "Naam", "De naam van het faalmechanisme."); PropertyDescriptor labelProperty = dynamicProperties[codePropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(labelProperty, generalCategory, "Label", "Het label van het faalmechanisme."); PropertyDescriptor inAssemblyProperty = dynamicProperties[inAssemblyPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(inAssemblyProperty, generalCategory, "In assemblage", "Geeft aan of dit faalmechanisme wordt meegenomen in de assemblage.", true); PropertyDescriptor nProperty = dynamicProperties[nPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nProperty, lengthEffectCategory, "N [-]", "De parameter 'N' die gebruikt wordt om het lengte-effect mee te nemen in de beoordeling."); PropertyDescriptor applySectionLengthInSectionProperty = dynamicProperties[applyLengthEffectInSectionPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(applySectionLengthInSectionProperty, lengthEffectCategory, "Toepassen lengte-effect binnen vak", "Geeft aan of het lengte-effect binnen een vak toegepast wordt."); }
/// <summary> /// Creates a new instance of <see cref="SpecificFailureMechanismView"/>. /// </summary> /// <param name="failureMechanism">The <see cref="SpecificFailureMechanism"/> to show the data for.</param> /// <param name="assessmentSection">The assessment section to show the data for.</param> /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception> public SpecificFailureMechanismView(SpecificFailureMechanism failureMechanism, IAssessmentSection assessmentSection) : base(failureMechanism) { if (assessmentSection == null) { throw new ArgumentNullException(nameof(assessmentSection)); } InitializeComponent(); this.failureMechanism = failureMechanism; this.assessmentSection = assessmentSection; }
public void SetSections_SectionsNull_ThrowArgumentNullException() { // Setup var failureMechanism = new SpecificFailureMechanism(); // Call void Call() => failureMechanism.SetSections(null, string.Empty); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("sections", exception.ParamName); }
public void SetSections_SourcePathNull_ThrowArgumentNullException() { // Setup var failureMechanism = new SpecificFailureMechanism(); // Call void Call() => failureMechanism.SetSections(Enumerable.Empty <FailureMechanismSection>(), null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("sourcePath", exception.ParamName); }
private static void ReadFailureMechanismSectionResults(this IFailureMechanismEntity entity, SpecificFailureMechanism specificFailureMechanism, ReadConversionCollector collector) { foreach (NonAdoptableWithProfileProbabilityFailureMechanismSectionResultEntity sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.NonAdoptableWithProfileProbabilityFailureMechanismSectionResultEntities)) { FailureMechanismSection failureMechanismSection = collector.Get(sectionResultEntity.FailureMechanismSectionEntity); NonAdoptableWithProfileProbabilityFailureMechanismSectionResult sectionResult = specificFailureMechanism.SectionResults.Single(sr => ReferenceEquals(sr.Section, failureMechanismSection)); sectionResultEntity.Read(sectionResult); } }
public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException() { // Setup var failureMechanism = new SpecificFailureMechanism(); // Call void Call() => new SpecificFailureMechanismContext(failureMechanism, null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("parent", exception.ParamName); }
public void CloseForData_ViewCorrespondingToRemovedFailureMechanism_ReturnsTrue() { // Setup var failureMechanism = new SpecificFailureMechanism(); var assessmentSection = new AssessmentSectionStub(); var view = new SpecificFailureMechanismView(failureMechanism, assessmentSection); // Call bool closeForData = info.CloseForData(view, failureMechanism); // Assert Assert.IsTrue(closeForData); mocks.VerifyAll(); }