小编Aut*_*aos的帖子

是否有超级标记逗号的Unicode符号?

在对YouTube视频进行翻译时(翻译只能使用Unicode,据我所知,没有其他标记可行),我偶然发现了橙汁中的H +浓度.它应该是负3.5摩尔的十倍.

我想把它写成"1·10 -3,5 M"(记住逗号,它被翻译成荷兰语).问题是我找不到所有120,520个unicode图形字符之间的上标逗号或上标时间段.

有人知道如何解决这个问题吗?

unicode special-characters

10
推荐指数
5
解决办法
8405
查看次数

是否有可能在VBScript中获得.Net字符串对象实例?

在VBScript中,您可以使用COM自动化使用某些.net类.当您想要使用动态数组,列表,队列等时,这会派上用场.

这将是很好,如果我可以使用字符串作为对象,所以我能做的所有花哨的字符串的东西吧,但每当我从另一个对象传递一个字符串,它是由VBScript中被视为一个字符串,而不是作为一个字符串对象:

Set s = CreateObject("System.Text.StringBuilder")
s.Append_3 "I love deadlines. I like the whooshing sound they make as they fly by."

' This gives me the literal string
MsgBox s.ToString
text = s.ToString

' But unfortunately this won't work
MsgBox s.ToString.Length
Set stringRef = s.ToString
Run Code Online (Sandbox Code Playgroud)

另外,将字符串创建为COM对象也不起作用:

Set s = CreateObject("System.String")      ' Nope.
Run Code Online (Sandbox Code Playgroud)

是否有人管理过这个,或者对此有其他想法?

.net string com vbscript

7
推荐指数
1
解决办法
4949
查看次数

使用Excel WorkSheet作为DataSource将测试结果写回TestContext

我们有很多测试,测试数据存储在Excel中.我创建其中Excel表被连接作为testmethods DataSourceTestContext.

为方便起见,我想用测试结果更新Excel工作表,以便很容易看到数据(或系统)的错误位置.

我试过的事情:

直接写到TestContext.DataRow:

TestContext.DataRow.BeginEdit();
TestContext.DataRow["Result"] = "change";
TestContext.DataRow.EndEdit();
TestContext.DataRow.AcceptChanges();
Run Code Online (Sandbox Code Playgroud)

结果:传递,但我的Excel文件中没有更新行.

通过以下方式更新DataConnection:

string currentRow = TestContext.DataRow["RowId"].ToString();
System.Data.Common.DbCommand cmd = TestContext.DataConnection.CreateCommand();
cmd.CommandText = String.Format("UPDATE {0} SET {1} = pass WHERE {2} = {3}", sheetName, columnName, "RowId", currentRow);
cmd.CommandType = System.Data.CommandType.Text;
cmd.ExecuteReader();
Run Code Online (Sandbox Code Playgroud)

结果: System.Data.OleDb.OleDbException: Syntax error in UPDATE statement.

并通过更改DataRow以下内容来更新它TestContext:

string currentRow = TestContext.DataRow["RowId"].ToString();
OleDbDataAdapter adapter = new OleDbDataAdapter();
adapter.UpdateCommand = new OleDbCommand(String.Format("UPDATE {0} SET {1} = pass WHERE {2} …
Run Code Online (Sandbox Code Playgroud)

c# unit-testing data-driven-tests

6
推荐指数
1
解决办法
1579
查看次数

从步骤定义中的 SpecFlow 功能文件中获取路径

是否可以在运行时在 Step Definition 中检索 SpecFlow 功能文件的路径?

片段:

[Given(@"Some given statement")]
public void GivenSomeGivenStatement() {

    var featureFilePath = // retrieve the path of the feature file 
                          // that executes this step.
}
Run Code Online (Sandbox Code Playgroud)

上下文:
我们对数据库和查询进行测试。源数据在 Excel 文件和 .SQL 文件(用于检查查询)中创建。这些源数据是大型数据集,无法放入特征文件本身或使用 SpecFlow.Plus.Excel 扩展名。
为了使数据靠近特征文件,我们希望将此数据与特征文件本身放在同一文件夹中。为此,我们需要此功能文件的路径,因此我们也有 testdata 的路径。

c# specflow

5
推荐指数
1
解决办法
3212
查看次数

在同一解决方案中重用另一个项目中的SpecFlow步骤

什么是重用SpecFlow Given/When/Then步骤的最佳方法?我找到了三种具有所有特定优点和缺点的方法,但我不相信这是最好的方法.

我在一个解决方案
ProjectA中有两个项目:

[Binding]
public class BookSteps : StepsBase
{
    [Given(@"the following books:")]
    public void GivenTheFollowingBooks(Table table)
    { 
        // ...
    }
}
Run Code Online (Sandbox Code Playgroud)
  1. 我可以像这样继承我的步骤:

ProjectB:

[Binding]
public class BookStepsReference : ProjectA.BookSteps { }
Run Code Online (Sandbox Code Playgroud)

这工作并且需要最少的工作.不幸的是,它打破了功能文件的智能感知:ProjectB功能文件中的步骤保持紫色.

  1. 我可以继承并创建一个具有相同签名的方法:

ProjectB:

[Binding]
public class BookStepsReference : ProjectA.BookSteps 
{ 
    [Given(@"the following books:")]
    public void GivenTheFollowingBooksReference(Table table)
    { 
        base.GivenTheFollowingBooks(table);
    }
}
Run Code Online (Sandbox Code Playgroud)

当我尝试运行测试时,这会中断,因为自动生成的功能步骤会看到两个带有Given属性的方法"以下书籍:"并抛出一个模糊的引用异常.

  1. 我创建了一个私有对象,它引用了项目A中的绑定步骤:

ProjectB:

[Binding]
public class BookStepsReference
{ 
    private ProjectA.BookSteps _bookSteps = new ProjectA.BookSteps();

    [Given(@"the following books:")]
    public void GivenTheFollowingBooks(Table table)
    { 
        _bookSteps.GivenTheFollowingBooks(table);
    }
}
Run Code Online (Sandbox Code Playgroud)

这有效,并且还在Feature …

c# specflow visual-studio-2012

5
推荐指数
1
解决办法
4103
查看次数

如何查找和配置SSIS包所需的参数以从代码中执行它们

我想从C#代码执行位于服务器上的SSIS包.

我试图让这个运行:

public void Execute()
{
    string folderName = "MYFOLDER";
    string projectName = "MYPROJECT";
    string serverName = @"MYSERVER\REGION";

    String connectionString = String.Format("Data Source={0};Initial Catalog=msdb;Integrated Security=SSPI;", serverName);

    using(SqlConnection sqlConnection = new SqlConnection(connectionString)) {
        IntegrationServices integrationServices = new IntegrationServices(sqlConnection);

        Catalog catalog = integrationServices.Catalogs["SSISDB"];
        CatalogFolder catalogFolder = catalog.Folders[folderName];

        PackageInfo package = catalogFolder.Projects[projectName].Packages[PackageName];


        PackageInfo.ExecutionValueParameterSet batchIdParameter = new PackageInfo.ExecutionValueParameterSet {
            ObjectType = package.Parameters["BatchId"].ObjectType,
            ParameterName = "BatchId",
            ParameterValue = package.Parameters["BatchId"].DesignDefaultValue
        };
        PackageInfo.ExecutionValueParameterSet dateIdParameter = new PackageInfo.ExecutionValueParameterSet
        {
            ObjectType = package.Parameters["DateId"].ObjectType,
            ParameterName = "DateId",
            ParameterValue = package.Parameters["DateId"].DesignDefaultValue …
Run Code Online (Sandbox Code Playgroud)

c# sql-server ssis

3
推荐指数
1
解决办法
2803
查看次数

VBScript 环境变量

我有一个关于我应该如何修复运行脚本时看到的错误的问题。我很确定这与我使用 %COMPUTERNAME% 环境变量的方式有关。

我的脚本所做的是在本地压缩一些文件,然后使用 robocopy 将它们复制到已安装或共享的驱动器,然后检查文件大小是否相同,如果相同,则删除原始计算机上的文件。如果过程中的任何步骤产生错误,它就会退出脚本。

现在,如果我不将“%COMPUTERNAME%”添加到最终目标路径,脚本就可以正常工作。(压缩文件最终会在哪里)我需要将压缩文件放入它们自己的文件夹中,并使用它起源的主机的名称,因为此脚本将在许多不同的机器上运行,所有机器都将运行在同一位置。

所以基本上它需要看起来像这样:

E:\LocalHostName\TestZip.zip

现在脚本将在复制压缩文件时很好地构建文件夹,一旦文件大小检查开始就会出现问题。我收到“FileToBeCompared2”行的“找不到文件”错误。我明白为什么会产生错误,因为它没有识别 %COMPUTERNAME% 环境变量,但我不知道如何解决这个问题。

我还将尝试添加一些功能,如果发生错误,则会在输出文件夹中生成带有“脚本期间发生错误”之类的文本文件。

提前感谢您的所有帮助。该脚本在下面找到:

'-------------------------------------------------------------------------------------------
'This script is used to zip files locally, copy them to a new location, verify that the
'files were copied correctly, and then delete the files from the original source.
'In it's current state it is being used as a means to zip event files and move them
'to a central location.

'Run with administrator priveleges.

'-----------------------------------------------------------------------------------------------------
Option Explicit

Dim sDirectoryPath, sLocalDestinationPath, sFinalDestinationPath, sOutputFilename, Shell, …
Run Code Online (Sandbox Code Playgroud)

vbscript environment-variables

1
推荐指数
1
解决办法
8206
查看次数