which mocking-framework do you use Luke?So when I do AOInitialize at classinitiliaze i am rid of my problems?
public IEditor GetEditor (UID uid, IApplication app) { IEditor editor = null; editor = app.FindExtensionByCLSID(uid) as IEditor; return editor; } [TestMethod()] public void GetEditor_MockingTest () { MockRepository mockrepo = new MockRepository(); PlotDocumentGeneratorClass plotter = new PlotDocumentGeneratorClass(); UID testuid = mockrepo.StrictMockWithRemoting<UIDClass>(); testuid.Value = "esriEditor.Editor"; IApplication testapp = mockrepo.StrictMock<IApplication>(); IEditor testeditor = plotter.GetEditor(testuid, testapp); Assert.IsNotNull(testeditor); }
Warning: Test Run deployment issue: The assembly or module 'ESRI.DADF.Core' directly or indirectly referenced by the container 'C:\[MyArcGISAddinDeploymentDirectory]\editorassisttests.dll' was not found.
[TestMethod()] public void CheckLayoutView_ReturnsIFeatureWorkspaceType () { MockRepository mockrepo = new MockRepository(); IPlotDocument plotter = mockrepo.DynamicMock<PlotDocumentGeneratorClass>(); IFeatureWorkspace transworkspace = plotter.SetCurrentWorkspace(); Assert.IsInstanceOfType(transworkspace, typeof(ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)); } [TestMethod()] public void GetEditor_MockingTest () { MockRepository mockrepo = new MockRepository(); PlotDocumentGeneratorClass plotter = new PlotDocumentGeneratorClass(); UID test = mockrepo.StrictMock<UID>(); Assert.IsNotNull(test); } [TestMethod()] public void GetWorkspace_ReturnsNotNull () { PlotDocumentGeneratorClass plotter = new PlotDocumentGeneratorClass(); IFeatureWorkspace ws = plotter.GetWorkspace("LBADGEROW", "C:\\", false); Assert.IsNotNull(ws); }
So you needed to change the mode to STA.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.