1

I have an apicontroller and I want test a method in a test project.

But if i call the method from unit project,i got an error.

The method that i want test, contain a code to execute a query in mdx

 Dim dataAdapter As Microsoft.AnalysisServices.AdomdClient.AdomdDataAdapter
 dataAdapter = New Microsoft.AnalysisServices.AdomdClient.AdomdDataAdapter(cmd)
 dataAdapter.Fill(_returnset)

the error (inner exception)is

{"Type not resolved for 'MyCompany.Security200.Principal,MyCompany.Security200, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'."}

the stacktrace

 in System.AppDomain.get_Evidence()
   in System.AppDomain.get_EvidenceNoDemand()
   in System.AppDomain.get_Evidence()
   in System.Configuration.ClientConfigPaths.GetEvidenceInfo(AppDomain appDomain, String exePath, String& typeName)
   in System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(AppDomain appDomain, String exePath)
   in System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)
   in System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)
   in System.Configuration.ClientConfigurationHost.RequireCompleteInit(IInternalConfigRecord record)
   in System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
   in System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
   in System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
   in System.Configuration.ConfigurationManager.GetSection(String sectionName)
   in System.Xml.XmlConfiguration.XmlReaderSection.get_ProhibitDefaultUrlResolver()
   in System.Xml.Schema.Parser..ctor(SchemaType schemaType, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventHandler)
   in System.Xml.Schema.XmlSchema.Read(XmlReader reader, ValidationEventHandler validationEventHandler)
   in Microsoft.AnalysisServices.AdomdClient.FormattersHelpers.LoadSchema(XmlReader xmlReader, ColumnDefinitionDelegate definitionDelegate, Boolean requirePrePostInit)
   in Microsoft.AnalysisServices.AdomdClient.FormattersHelpers.LoadSchema(XmlReader xmlReader, ColumnDefinitionDelegate definitionDelegate)
   in Microsoft.AnalysisServices.AdomdClient.NamespacesMgr..cctor()

with web application it work, but not for test project. i use moq and

var context = new Mock<HttpContextBase>();
var user = new Mock<IPrincipal>();     
var identity = new Mock<IIdentity>();
WindowsIdentity ed = WindowsIdentity.GetCurrent();
context.Setup(ctx => ctx.User).Returns(user.Object); 
context.Setup(ctx => ctx.User.Identity).Returns(ed);            
user.Setup(x => x.Identity).Returns(ed);

thanks

After some attemps, i found that there is this exception only on debugging the test project, but not in execution of test.

Does anyone have an idea on the reason of this behavior?

user3401335
  • 2,335
  • 2
  • 19
  • 32

0 Answers0