Unit testing via BizUnit vs Visual Studio Test Method

Jul 28, 2014 at 11:51 PM
Edited Jul 28, 2014 at 11:55 PM
Hi,

I am trying to do some unit testing for an Oracle auto-generated schema. I have written two methods, one using the BizUnit features and other one using default features available in Visual Studio Unit test project. The one that uses BizUnit dlls works fine and validate instance is successful where as the other one always fails. Is it something to do with the multiple root elements present in the autogenerated schema which only the BizUnit framework seems to understand ?

Following are the two simple test methods:


[TestMethod]
public void TestMethod_DefaultValidateOracleInputInstance()
{
PASH.Provider.Orchestrations.ProviderData.ProviderDataFromOracle_PK_APCD_DATA_PULL ins = new PASH.Provider.Orchestrations.ProviderData.ProviderDataFromOracle_PK_APCD_DATA_PULL {};


bool success = false;
success = ins.ValidateInstance(@"C:\APCD-Biztalk\PASH.Provider\TestFiles\Test.xml", Microsoft.BizTalk.TestTools.Schema.OutputInstanceType.XML);

Assert.IsTrue(success);
}


[TestMethod]
public void TestMethod_BizUnitValidateOracleInputInstance()
{
var checkInputFile = new TestCase { Name = "Input file validation test" };

//Create a validating read step
//We should only have one file in the directory
var validatingFileReadStep = new FileReadMultipleStep
{
DirectoryPath = @"C:\APCD-Biztalk\PASH.Provider\TestFiles\BizUnitPollingFolder",
//SearchPattern = "{*}.xml",
SearchPattern = "ProviderOrchestrationStarter.xml",
ExpectedNumberOfFiles = 1,
Timeout = 4500,
//DeleteFiles = false
};


//Create an XML Validation step
//This will check the result against the XSD for the document

var validation = new XmlValidationStep();
var schemaSummary = new SchemaDefinition
{
XmlSchemaPath =
@"C:\BizTalk Projects\Testing\21st July Provider\PASH.Provider\PASH.Provider.Orchestrations.ProviderData\ProviderDataFromOracle_PK_APCD_DATA_PULL.xsd",
XmlSchemaNameSpace =
"http://Microsoft.LobServices.OracleDB/2007/03/TPDS/Package/PK_APCD_DATA_PULL"
};
validation.XmlSchemas.Add(schemaSummary);
validatingFileReadStep.SubSteps.Add(validation);

checkInputFile.ExecutionSteps.Add(validatingFileReadStep);

var bizUnit = new BizUnit.BizUnit(checkInputFile);
bizUnit.RunTest();
}

Regards
Jul 29, 2014 at 9:56 PM
Tried searching a bit on using BizUnit for doing a validate instance on Autogenerated schemas (especially with multiple roots). But no luck. Appreciate if some one can share some info on this.