public void IsEnabled_FailureMechanismSectionsSourcePathSet_ReturnTrue() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); string sourcePath = TestHelper.GetScratchPadPath(); failureMechanism.SetSections(Enumerable.Empty <FailureMechanismSection>(), sourcePath); var context = new GrassCoverErosionOutwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection); using (var plugin = new GrassCoverErosionOutwardsPlugin()) { UpdateInfo importInfo = GetUpdateInfo(plugin); // Call bool isEnabled = importInfo.IsEnabled(context); // Assert Assert.IsTrue(isEnabled); } mocks.VerifyAll(); }
public void CurrentPath_FailureMechanismSectionsSourcePathSet_ReturnsExpectedPath() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); string sourcePath = TestHelper.GetScratchPadPath(); failureMechanism.SetSections(Enumerable.Empty <FailureMechanismSection>(), sourcePath); var context = new GrassCoverErosionOutwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection); using (var plugin = new GrassCoverErosionOutwardsPlugin()) { UpdateInfo updateInfo = GetUpdateInfo(plugin); // Call string currentFilePath = updateInfo.CurrentPath(context); // Assert Assert.AreEqual(sourcePath, currentFilePath); mocks.VerifyAll(); } }
public void Constructor_ExpectedValues() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); // Call var context = new GrassCoverErosionOutwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection); // Assert Assert.IsInstanceOf <FailureMechanismSectionsContext>(context); Assert.AreSame(failureMechanism, context.WrappedData); Assert.AreSame(assessmentSection, context.AssessmentSection); mocks.VerifyAll(); }
public void CreateFileImporter_WithValidData_ReturnsFileImporter() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); assessmentSection.Stub(a => a.ReferenceLine).Return(new ReferenceLine()); mocks.ReplayAll(); var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); var context = new GrassCoverErosionOutwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection); using (var plugin = new GrassCoverErosionOutwardsPlugin()) { UpdateInfo updateInfo = GetUpdateInfo(plugin); // Call IFileImporter importer = updateInfo.CreateFileImporter(context, string.Empty); // Assert Assert.IsInstanceOf <FailureMechanismSectionsImporter>(importer); mocks.VerifyAll(); } }
public void IsEnabled_FailureMechanismSectionsSourcePathNull_ReturnFalse() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); var context = new GrassCoverErosionOutwardsFailureMechanismSectionsContext(failureMechanism, assessmentSection); using (var plugin = new GrassCoverErosionOutwardsPlugin()) { UpdateInfo importInfo = GetUpdateInfo(plugin); // Call bool isEnabled = importInfo.IsEnabled(context); // Assert Assert.IsFalse(isEnabled); } mocks.VerifyAll(); }