I have Visual Studio 2010 and Visual Studio 2012 installed. Using JustMock version 2012.3.1016.3
Running the tests below I get the following in both VS 2010 and 2012.
Test Name: TestReadXML
Test FullName: DemoSerializationExceptionMock.ReadXMLMockIBusinessPrincipal_Tests.TestReadXML
Test Source: C:\Projects\MAS Applications\Experimental\Source\DemoSerializationExceptionMock\DemoSerializationExceptionMock\ReadXMLMockIBusinessPrincipal_Tests.vb : line 47
Test Outcome: Failed
Test Duration: 0:00:00.00937
Result Message:
Test method DemoSerializationExceptionMock.ReadXMLMockIBusinessPrincipal_Tests.TestReadXML threw exception:
System.Runtime.Serialization.SerializationException: Type is not resolved for member 'IPrincipalProxy+bce4039c8c9143c29217f51daf99a9a8,Telerik.JustMock, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8b221631f7271365'.
Result StackTrace:
at System.AppDomain.get_Evidence()
at System.AppDomain.get_EvidenceNoDemand()
at System.AppDomain.get_Evidence()
at System.Configuration.ClientConfigPaths.GetEvidenceInfo(AppDomain appDomain, String exePath, String& typeName)
at System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(AppDomain appDomain, String exePath)
at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)
at System.Configuration.ClientConfigurationHost.RequireCompleteInit(IInternalConfigRecord record)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at System.Xml.XmlConfiguration.XmlReaderSection.get_ProhibitDefaultUrlResolver()
at System.Xml.XmlReaderSettings.GetXmlResolver_CheckConfig()
at System.Xml.Schema.XmlSchemaSet.PreprocessSchema(XmlSchema& schema, String targetNamespace)
at System.Xml.Schema.XmlSchemaSet.Add(String targetNamespace, XmlSchema schema)
at System.Xml.Schema.XmlSchemaSet.Add(XmlSchema schema)
at System.Xml.Schema.XmlSchemaInference.CreateXmlSchema(String targetNS)
at System.Xml.Schema.XmlSchemaInference.AddElement(String localName, String prefix, String childURI, XmlSchema parentSchema, XmlSchemaObjectCollection addLocation, Int32 positionWithinCollection)
at System.Xml.Schema.XmlSchemaInference.InferSchema1(XmlReader instanceDocument, XmlSchemaSet schemas)
at System.Xml.Schema.XmlSchemaInference.InferSchema(XmlReader instanceDocument)
at System.Data.DataSet.InferSchema(XmlDocument xdoc, String[] excludedNamespaces, XmlReadMode mode)
at System.Data.DataSet.ReadXml(XmlReader reader, Boolean denyResolving)
at System.Data.DataSet.ReadXml(TextReader reader)
at DemoSerializationExceptionMock.ReadXMLMockIBusinessPrincipal_Tests.TestReadXML() in C:\Projects\MAS Applications\Experimental\Source\DemoSerializationExceptionMock\DemoSerializationExceptionMock\ReadXMLMockIBusinessPrincipal_Tests.vb:line 43
Imports
Microsoft.VisualStudio.TestTools.UnitTesting.Web
Imports
Microsoft.VisualStudio.TestTools.UnitTesting
Imports
Telerik.JustMock
Imports
System.Security.Principal
<TestClass()> _
Public
Class
ReadXMLMockIBusinessPrincipal_Tests
Private
testContextInstance
As
TestContext
Public
Property
TestContext
As
TestContext
Get
Return
testContextInstance
End
Get
Set
(
ByVal
Value
As
TestContext)
testContextInstance = Value
End
Set
End
Property
<TestInitialize()>
Public
Sub
TestInit()
Dim
idnty
As
IIdentity = Mock.Create(Of IIdentity)()
Mock.Arrange(
Function
() idnty.AuthenticationType).Returns(
"MOCK"
)
Mock.Arrange(
Function
() idnty.IsAuthenticated).Returns(
True
)
Mock.Arrange(
Function
() idnty.Name).Returns(
"mockident"
)
Dim
prince
As
IPrincipal = Mock.Create(Of IPrincipal)()
Mock.Arrange(
Function
() prince.Identity).Returns(idnty)
Mock.Arrange(
Function
() prince.IsInRole(Arg.AnyString())).Returns(
True
)
System.Threading.Thread.CurrentPrincipal = prince
End
Sub
Dim
elem
As
XElement = <Root>
</Root>
<TestMethod()> _
Public
Sub
TestReadXML_IgnoreSchema()
Dim
ds
As
New
DataSet
ds.ReadXml(
New
IO.StringReader(elem.ToString), XmlReadMode.IgnoreSchema)
'<- Passed
End
Sub
<TestMethod()> _
Public
Sub
TestReadXML()
Dim
ds
As
New
DataSet
ds.ReadXml(
New
IO.StringReader(elem.ToString))
'<-Fails
End
Sub
End
Class