public void CreateFileImporter_Always_ReturnFileImporter() { // Setup var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var importTarget = new ReferenceLineContext(new ReferenceLine(), assessmentSection); // Call IFileImporter importer = importInfo.CreateFileImporter(importTarget, ""); // Assert Assert.IsInstanceOf <ReferenceLineImporter>(importer); }
public void CreateInstance_WithContext_ReturnReferenceLineProperties() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var context = new ReferenceLineContext(new ReferenceLine(), assessmentSection); // Call IObjectProperties objectProperties = info.CreateInstance(context); // Assert Assert.IsInstanceOf <ReferenceLineProperties>(objectProperties); Assert.AreSame(context.WrappedData, objectProperties.Data); mocks.VerifyAll(); }
public void Constructor_ExpectedValues() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var referenceLine = new ReferenceLine(); // Call var context = new ReferenceLineContext(referenceLine, assessmentSection); // Assert Assert.IsInstanceOf <ObservableWrappedObjectContextBase <ReferenceLine> >(context); Assert.AreSame(referenceLine, context.WrappedData); Assert.AreSame(assessmentSection, context.AssessmentSection); mocks.VerifyAll(); }
public void Text_Always_ReturnsName() { // 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 string text = info.Text(context); // Assert Assert.AreEqual("Referentielijn", text); } mocks.VerifyAll(); }
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 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(); }
public void CreateFileExporter_Always_ReturnFileExporter() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); mocks.ReplayAll(); var context = new ReferenceLineContext(new ReferenceLine(), assessmentSection); const string filePath = "test"; using (var plugin = new RiskeerPlugin()) { ExportInfo info = GetExportInfo(plugin); // Call IFileExporter fileExporter = info.CreateFileExporter(context, filePath); // Assert Assert.IsInstanceOf <ReferenceLineExporter>(fileExporter); } mocks.VerifyAll(); }
public void IsEnabled_ReferenceLineWithGeometry_ReturnTrue() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub <IAssessmentSection>(); assessmentSection.Stub(a => a.ReferenceLine).Return(ReferenceLineTestFactory.CreateReferenceLineWithGeometry()); mocks.ReplayAll(); var context = new ReferenceLineContext(assessmentSection.ReferenceLine, assessmentSection); using (var plugin = new RiskeerPlugin()) { ExportInfo info = GetExportInfo(plugin); // Call bool isEnabled = info.IsEnabled(context); // Assert Assert.IsTrue(isEnabled); } mocks.VerifyAll(); }