I’ve written a unit test for a map which has XML as the source and a flat file schema as the target.
I can set the “TestMap Output” property of the map to XML or native. When I then right-click the map in solution explorer and select Test Map, it works great, I get either an XML file or a flat file depending in the value I selected for the “TestMap Output” property. In both cases all expected fields are populated with the correct value from the input XML document.
My problem comes when I execute a unit test using the TestMap method of the class Microsoft.BizTalk.TestTools.Mapper.TestableMapBase. I am getting the error “Object reference not set to an instance of an object”, here is the stack trace:
at Microsoft.BizTalk.TOM.CXSDSchemaTree.CreateNativeInstance(String strXMLInstFileName, String strNativeInstanceOutputFileName, InstanceGenerationOptions options, ITOMErrorInfo[]& errInstanceCreationErrors)
at Microsoft.BizTalk.TOM.CXSDSchemaTree.CreateNativeInstanceFromXMLInstance(String strXMLInstFileName, String strNativeInstFileName, ITOMErrorInfo[]& errInstCreationErrors)
at Microsoft.BizTalk.TestTools.Mapper.TestableMapBase.TestMap(String inputInstanceFilename, InputInstanceType inputType, String outputInstanceFilename, OutputInstanceType outputType)
at x.Int.WMS.Testing.Unit.UnitTests.FromAx.UnitTest_CanonicalCustomer_2_MLS_MRE.CallMap(TestableMapBase target) in C:\Development\x.Int.WMS\Dev\V1.0\Src\Solutions\WMS\x.Int.WMS.Testing.Unit\UnitTests\FromCanonical\UnitTest_CanonicalCustomer_2_MLS_MRE.cs:line 68
at x.Int.WMS.Testing.Unit.UnitTests.FromAx.UnitTest_CanonicalCustomer_2_MLS_MRE.SetupTest() in C:\Development\x.Int.WMS\Dev\V1.0\Src\Solutions\WMS\x.Int.WMS.Testing.Unit\UnitTests\FromCanonical\UnitTest_CanonicalCustomer_2_MLS_MRE.cs:line 33
at x.Int.WMS.Testing.Unit.UnitTests.FromAx.UnitTest_CanonicalCustomer_2_MLS_MRE.RecordID_IsMapped() in C:\Development\x.Int.WMS\Dev\V1.0\Src\Solutions\WMS\x.Int.WMS.Testing.Unit\UnitTests\FromCanonical\UnitTest_CanonicalCustomer_2_MLS_MRE.cs:line 45
Any ideas?
Problem was caused by old assembly in the GAC.