BizUnit error Unit Test Adapter threw exception: Object must implement IConvertible..

Dec 16, 2015 at 1:59 PM
Hello All,

I have written a BizUnit test case and the files is getting processed and everything but my Unit test is failing with the error as

Unit Test Adapter threw exception:
Object must implement IConvertible..

My Test method code is :
public void Negative_oppoUsageRequest_HU()
    {
        TestCase negative_oppoUsagetest_HU = new TestCase();
        negative_oppoUsagetest_HU.Name = "Negative_oppoUsagetest_HU_UnitTest";

        ////Delete files already present
        var filePathsToDelete = new Collection<string> { @"\\127.0.0.1\EaiShare\UsageRequests\PPI.UsageRequest.CaptureHUResponseMessage_Msg\*.xml" };
        DeleteStep deleteFiles = new DeleteStep();
        deleteFiles.FilePathsToDelete = filePathsToDelete;
        negative_oppoUsagetest_HU.SetupSteps.Add(deleteFiles);

        ////Creating an instance of the sample file as input.
        var xdl = new BizUnit.TestSteps.DataLoaders.Xml.XmlDataLoader();
        xdl.FilePath = @"..\..\..\D.B2B.CNI.CRM.PPI.UsageRequest.UnitTests\Sample Files\oppo_HU_sample.xml";

        ////Calling the inbound WCF service
        var ws = new WebServiceStep();
        ws.Action = "SFDCWCFOperation";
        ws.FailOnError = false;
        ws.RequestBody = xdl;
        ws.ServiceUrl = "http://localhost/SFDCWCFService/SFDCIncomingWCFService.svc";
        negative_oppoUsagetest_HU.ExecutionSteps.Add(ws);

        ////Delay step has been added to keep the other services running while BizTalk sends them a request.
        BizUnit.TestSteps.Time.DelayStep delayResponse = new BizUnit.TestSteps.Time.DelayStep();
        delayResponse.DelayMilliSeconds = 40000;
        negative_oppoUsagetest_HU.ExecutionSteps.Add(delayResponse);

        ////Create a validating read step
        ////We should only have 2 file in the directory
        var validatingHUResponseStep = new FileReadMultipleStep
        {
            DirectoryPath = @"\\127.0.0.1\EaiShare\UsageRequests\PPI.UsageRequest.CaptureHUResponseMessage_Msg",
            SearchPattern = "*.xml",
            ExpectedNumberOfFiles = 2,
            Timeout = 3000,
            DeleteFiles = false
        };

        var validation = new XmlValidationStep();
        var schemaHUResponse = new SchemaDefinition
        {
            XmlSchemaPath =
                @"..\..\..\D.B2B.CNI.CRM.PPI.UsageRequest.UnitTests\Sample Files\UnitTestCaseSchema.xsd",
            XmlSchemaNameSpace =
                "http://D.B2B.CNI.CRM.PPI.UsageRequest.Schemas.UnitTestCaseSchema"
        };
        validation.XmlSchemas.Add(schemaHUResponse);

        ////Create an XPath Validation.  This will check a value in the output.
        ////The Xpath for the node can be grabbed from the Instance XPath property on the XSD.
        var checkValid = new BizUnit.TestSteps.Common.XPathDefinition
        {
            Description = "Response",
            XPath =
            @"/*[local-name()='CreateEsgRequestResponse' and namespace-uri()='http://tempuri.org/']/*[local-name()='CreateEsgRequestResult' and namespace-uri()='http://tempuri.org/']",
            Value = "false"
        };
        validation.XPathValidations.Add(checkValid);
        validatingHUResponseStep.SubSteps.Add(validation);
        negative_oppoUsagetest_HU.ExecutionSteps.Add(validatingHUResponseStep);

        var bizunit = new BizUnit.BizUnit(negative_oppoUsagetest_HU);
        bizunit.RunTest();
    }