chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
Hi Scott

I have installed the 3.6.1 version of the product onto my virtual machine to poc the new software version before rolling out to buildservers and requesting the developers to upgrade.

I have found the following when I do a compile of the source:
(this was working 100% with version 3.6.0)

Our UnitTest
[Test]
public void CreateValueObjectDataSourceNotNull()
{
Mock xpathDocumentMock = MockManager.Mock(typeof (XPathDocument), Constructor.Mocked);
MockObject xpathNavigator = MockManager.MockObject(typeof (XPathNavigator), Constructor.Mocked);
xpathDocumentMock.ExpectAndReturn("CreateNavigator", xpathNavigator.Object as XPathNavigator);

ValueObjectResourceAttribute attribute = new ValueObjectResourceAttribute("Sanlam.SanQuote.Business.UnitTest.Domain.TitleMock.xml");
ValueObjectDataSource<TitleMock> dataSource = new ValueObjectDataSource<TitleMock>(attribute);
Assert.IsNotNull(dataSource);
}

Exception received
Sanlam.SanQuote.Business.UnitTest.Domain.ValueObjectDataSourceFixture.CreateValueObjectDataSourceNotNull : System.TypeInitializationException : The type initializer for 'MockXPathNavigator' threw an exception.
----> System.MethodAccessException : System.Xml.XPath.XPathNavigator..cctor()
at System.Runtime.CompilerServices.RuntimeHelpers._RunClassConstructor(IntPtr type)
at System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(RuntimeTypeHandle type)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at TypeMock.MockManager.MockObject(Type type, Constructor mockConstructors, Object[] args)
at Sanlam.SanQuote.Business.UnitTest.Domain.ValueObjectDataSourceFixture.CreateValueObjectDataSourceNotNull() in C:BuildPhoenix 3.0CodeSanlam.SanQuote.Business.UnitTestDomainValueObjectsValueObjectDataSourceFixture.cs:line 17
--TypeInitializationException
at MockXPathNavigator..cctor()

Thank you for the support
Righardt Marais
Sanlam Life - Sanquote Project
South Africa
asked by rmarais (640 points)

5 Answers

0 votes
Hi
This is a bug :cry:
Thank you for pointing it out. We will fix it and I will send you patch offline.
answered by ohad (35.4k points)
0 votes
Thank you very much for the support.
Awaiting your fix.
Thanks
Righardt
answered by rmarais (640 points)
0 votes
Hi
The patch was created and sent offline.
8)
answered by ohad (35.4k points)
0 votes
I believe I have the same problem. I've recently upgraded from 3.6.0.0 to 3.6.1.0 and where I used to have no problems I now have several tests that fail with the message:

An unhandled exception of type 'System.MethodAccessException' occurred in mscorlib.dll

Additional information: MyControlClass..cctor()

TestCase 'MyControlTests.TestName'
failed: Expected: System.NotSupportedException but was System.Reflection.TargetInvocationException
at System.Reflection.RuntimeConstructorInfo.InternalInvoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean isBinderDefault)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at TypeMock.MockManager.MockObject(Type type, Constructor mockConstructors, Object[] args)
c:path oile.cs(42,0): at MyControlTests.TestName()


This is a unit test for a class that derives from System.Web.UI.WebControls.WebControl.
answered by tillig (6.7k points)
0 votes
Hi
Patch was sent 8)
Check your mail ...
answered by ohad (35.4k points)
...