I encounter an issue when trying to use unit testing for BizTalk 2020 artefacts in Visual Studio 2019.
Here are the steps I have followed :
using Testing.Pipelines;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
namespace _Test
{
/// <summary>
///This is a test class for Test_ppr_Testing and is intended
///to contain all Test_ppr_Testing Unit Tests
///</summary>
[TestClass()]
public class Test_ppr_Testing
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
/// <summary>
///A test for ppr_Testing Constructor
///</summary>
[TestMethod()]
public void Test_ppr_TestingConstructor()
{
ppr_Testing target = new ppr_Testing();
var lDocuments = new System.Collections.Specialized.StringCollection();
lDocuments.Add(@"C:\MyTestDirectory\SomeFile.xml");
var lParts = new System.Collections.Specialized.StringCollection();
var lSchemas = new System.Collections.Generic.Dictionary<string, string>();
try
{
target.TestPipeline(lDocuments, lParts, lSchemas);
var lTmp = this.TestContext;
}
catch (Exception ex)
{
Assert.Fail(ex.ToString());
}
}
}
}
Result :
Am I doing something wrong, or is my Visual Studio 2019 installation corrupted ?
I'm in the process of migrating from BizTalk 2010 to BizTalk 2020, and with BizTalk 2010 and Visual Studio 2010 things were easier :
Thanks in advance for any help.
When building a BizTalk project with BizTalk artefacts in it (btm/btp/xsd), BizTalk will generate .cs files for those files in the project. The generated .cs files are not automatically added to the project itself, and this causes Intellisense in the unit test project to not being able to "see" the types. If you include the .cs files and rebuild, the issue should go away. However note that adding the generated the cs files to the project and to a code repository can introduce issues when building due to locked files.