Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 字符串在索引0c处不同#_C#_Bdd_Specflow - Fatal编程技术网

C# 字符串在索引0c处不同#

C# 字符串在索引0c处不同#,c#,bdd,specflow,C#,Bdd,Specflow,我正在运行specflow测试。这在我的“Then”步骤中失败了。我不知道为什么会发生这种异常。我的代码没有任何异常,我相信我的“Then”步骤已经正确实现 我的“Then”步骤是经过编码的,因此它会查找特定的文件路径,然后使用预期数据验证文件路径中的数据 例外情况 Message: Expected string length 21 but was 942. Strings differ at index 0. Expected: "6677,6677_6677,3001,6" B

我正在运行specflow测试。这在我的“Then”步骤中失败了。我不知道为什么会发生这种异常。我的代码没有任何异常,我相信我的“Then”步骤已经正确实现

我的“Then”步骤是经过编码的,因此它会查找特定的文件路径,然后使用预期数据验证文件路径中的数据

例外情况

Message:   Expected string length 21 but was 942. Strings differ at index 0.
  Expected: "6677,6677_6677,3001,6"
  But was:  "----- Executing Environment setup script - /orabin/app/oracle..."
  -----------^
代码:


该文件不包含您期望的内容。
“cat{processFilePath}{Path}”
可疑-您可能打算使用
Path.Combine
?消息为assert error。我相信,行
var actual=Common.LinuxCommandExecutor.RunLinuxcommand($“cat{processFilePath}{Path}”)
正在返回进程日志,而不是返回预期的日志。如果预期的输出是多行输出响应的一行的一部分,那么您应该检查包含而不是相等。@DaisyShipton(如果我使用path.combine)。如何处理我的示例?@user1672994多行输出响应然后您应该检查包含而不是相等。这是正确的。在“实际值”中,将生成多个输出irm_pgfw_trntmf_fcvt.csv.ovr'将只是生成的长列表中的一个文件
    [Given(@"Inventory interface is generated")]
    public void GivenInventoryInterfaceIsGenerated()
    {

        Row TestData = Common.Common.ReadDataFromCSV("Inventory");
        ScenarioContext.Current["Inventory"] = TestData;
        new ConvertToCSV().CreateInterfaceData(ConfigurationManager.AppSettings["InventoryDatFile"], TestData["Inventory"]);
    }


    [Given("I Loaded LifeCycle Measurement in domain for the (.*)")]
    public void GivenLifecyclestatusIsLoaded(string LifeCycleStatus)
    {
        Row TestData = Common.Common.ReadDataFromCSV("Foundation");

        new ConvertToCSV().CreateInterfaceData(ConfigurationManager.AppSettings[LifeCycleStatus + "lifecyclestatusCSVFileName"],
            TestData["lifecyclestatus"]);
    }

    [When(@"Inventory batch is executed")]
    public void InventoryBatchIsExecuted()
    {
        Row TestData = (Row)ScenarioContext.Current["Inventory"];
        Common.LinuxCommandExecutor
            .RunLinuxcommand(TestData["InventoryCommands"].ToString());

    }

    [Then(@"Transfer out measure should be generated (.*)")]

    public void ValidateInventoryMeasurement(string lifecyclestatus)

    {
        var Path = "irm_pgfw_trntmf_fcvt.csv.ovr";
        const string processFilePath = "/orabin/app/oracle/product/asos/inputs/ff/ff/actuals/";
        var actual = Common.LinuxCommandExecutor
                           .RunLinuxcommand($"cat {processFilePath} {Path}");

        var expected = "6677,6677_6677,3001,6";

        Assert.AreEqual(expected, actual);
    }