我正在使用审批测试.在我的开发机器上DiffReporter,当我的测试结果与批准的不同时,我很高兴开始使用TortoiseDiff:
[UseReporter(typeof (DiffReporter))]
public class MyApprovalTests
{ ... }
Run Code Online (Sandbox Code Playgroud)
但是,当在Teamcity上运行相同的测试并且结果不同时,测试将失败,并显示以下错误:
System.Exception : Unable to launch: tortoisemerge.exe with arguments ...
Error Message: The system cannot find the file specified
---- System.ComponentModel.Win32Exception : The system cannot find the file
specified
Run Code Online (Sandbox Code Playgroud)
显然它找不到tortoisemerge.exe,这很好,因为它没有安装在构建代理上.但是如果它被安装了怎么办?然后对于每个失败,另一个tortoisemerge.exe实例将启动,没有人会关闭它.最终吨的tortoisemerge.exe实例将杀死我们的服务器:)
所以问题是 - 如何修改测试以在本地机器上运行Tortoise Diff并仅在构建服务器上报告错误?我知道 #IF DEBUG [UseReporter(typeof (DiffReporter))]但如果可能的话会更喜欢另一种解决方案.
我想知道是否可以创建一个XSLT样式表,它将为给定XML文件中的所有叶元素提取XPATH.例如
<?xml version="1.0" encoding="UTF-8"?>
<root>
<item1>value1</item1>
<subitem>
<item2>value2</item2>
</subitem>
</root>
Run Code Online (Sandbox Code Playgroud)
输出将是
/root/item1
/root/subitem/item2
Run Code Online (Sandbox Code Playgroud) 当我尝试从VS Code终端登录Azure RM时,它就会挂起.没有显示登录/密码的提示.
有没有办法从该终端登录?否则运行/调试Azure PS脚本变得比它应该更复杂:)
我正在进行.NET Core应用程序的集成测试,并希望使用一些测试配置.我的配置是一个POCO类,通过appsettings.json然后通过消耗配置IOptions<T>.在我的测试中,我想使用该类的实例.
这是代码:
var mySettings = GetTestSettings(); // factory method returning POCO class
var configurationBuilder = new ConfigurationBuilder();
// I am looking for something like
configurationBuilder.AddInMemoryObject("Settings", mySettings);
// does not work, result is just string
configurationBuilder.AddInMemoryCollection("Settings",
JsonConvert.SerializeObject(mySettings));
// requires filename
configurationBuilder.AddJsonFile("filename.json");
Run Code Online (Sandbox Code Playgroud)
将POCO提供给配置的最简单方法是什么?
在SqlConnection.Open()中发生超时的情况是什么?
在AppProcess回收10秒后,在我们的一个IIS框中出现以下异常:
Type : System.Data.SqlClient.SqlException, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Source : .Net SqlClient Data Provider
Help link :
Errors : System.Data.SqlClient.SqlErrorCollection
Class : 11
LineNumber : 0
Number : -2
Procedure :
Server : XXX
State : 0
ErrorCode : -2146232060
Data : System.Collections.ListDictionaryInternal
TargetSite : Void OnError(System.Data.SqlClient.SqlException, Boolean)
Stack Trace : at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) …Run Code Online (Sandbox Code Playgroud) 当我尝试使用带有[Theory]属性的单元测试批准时,它说:
System.Exception: System.Exception : Approvals is not set up to use your test framework.
It currently supports [NUnit, MsTest, MbUnit, xUnit.net]
To add one use ApprovalTests.StackTraceParsers.StackTraceParser.AddParser() method to add implementation of ApprovalTests.StackTraceParsers.IStackTraceParser with support for your testing framework.
To learn how to implement one see http://blog.approvaltests.com/2012/01/creating-namers.html
at ApprovalTests.StackTraceParsers.StackTraceParser.Parse(StackTrace stackTrace)
at ApprovalTests.Namers.UnitTestFrameworkNamer..ctor()
at ApprovalTests.Approvals.GetDefaultNamer()
at ApprovalTests.Approvals.Verify(IApprovalWriter writer)
at ApprovalTests.Approvals.Verify(Object text)
Run Code Online (Sandbox Code Playgroud)
似乎它只识别[Fact]属性.我试图关注stacktrace中的链接, 但没有关于如何将自己的名称/解析器插入批准的内容.
有没有我可以添加自己的名字/解析器的入口点?它本身似乎微不足道,唯一的问题是如何使用它:
public class TheoryNamer : AttributeStackTraceParser
{
protected override string GetAttributeType()
{ …Run Code Online (Sandbox Code Playgroud) 我正在使用使用字符串作为主键的brownfield数据库.使用Fluent NHibernate和Sqlite(内存提供程序进行单元测试)和SQL Server 2005.
我有以下实体:
public class Entity
{
public virtual DateTime TimeStamp { get; set; }
public virtual string Name { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
有了这个映射:
public class EntityMap : ClassMap<Entity>
{
public EntityMap()
{
Map(_ => _.TimeStamp);
Id(_ => _.Name).CustomType("AnsiString");
}
}
Run Code Online (Sandbox Code Playgroud)
然而它说不起作用 NHibernate.TypeMismatchException : Provided id of the wrong type. Expected: System.Int32, got System.String
如何使这项工作?另外,有没有关于流利的nhibernate可用的良好文档?
提前致谢.
当我运行批准测试时,批准测试的一些调试输出会进入我的日志.看起来像
2/15/2016 1:58:48 PM ~000002ms Variable: approvalFrame = ''
2/15/2016 1:58:48 PM ~000025ms Variable: approvalFrame = ''
2/15/2016 1:58:48 PM ~000003ms Variable: approvalFrame = ''
2/15/2016 1:58:48 PM ~000002ms Variable: approvalFrame = '......
有没有办法将其隐藏在日志中?
谢谢.
我通过Visual Studio的软件包管理器控制台使用Nuget.对于每个项目,我需要添加一些软件包,例如xunit.contribs,fluentassertions和nsubstitute.为此,我在consolle中键入3个命令.
我知道控制台只是另一个PowerShell主机,应该有一种方法来创建一个脚本(一种Add-Test-Stuff.ps1),它将一次添加几个包.最好的方法是什么?
我有一个包含 XML 的字符串。我想从中创建一个 XML 文档。我正在使用 Load 和 LoadXMl 方法,如下所示:
Dim doc As XmlDocument
doc.LoadXml(applicationXml)
Run Code Online (Sandbox Code Playgroud)
但他们正在重新调整:
Object reference not set to an instance of an object.
Run Code Online (Sandbox Code Playgroud)
我的 XML 看起来像这样:
<gate.util.persistence.GateApplication>
<urlList class="gate.util.persistence.CollectionPersistence">
<localList>
<gate.util.persistence.PersistenceManager-URLHolder>
<urlString>$gatehome$plugins/LingPipe/</urlString>
</gate.util.persistence.PersistenceManager-URLHolder>
<gate.util.persistence.PersistenceManager-URLHolder>
<urlString>$gatehome$plugins/ANNIE/</urlString>
</gate.util.persistence.PersistenceManager-URLHolder>
<gate.util.persistence.PersistenceManager-URLHolder>
<urlString>$gatehome$plugins/Stemmer_Snowball/</urlString>
</gate.util.persistence.PersistenceManager-URLHolder>
</localList>
<collectionType>java.util.ArrayList</collectionType>
</urlList>
<application class="gate.util.persistence.SerialAnalyserControllerPersistence">
<prList class="gate.util.persistence.CollectionPersistence">
<localList>
<gate.util.persistence.PRPersistence>
<runtimeParams class="gate.util.persistence.MapPersistence">
<mapType>gate.util.SimpleFeatureMapImpl</mapType>
<localMap>
<entry>
<string>setsToKeep</string>
<null />
</entry>
<entry>
<string>document</string>
<null/>
</entry>
<entry>
<string>annotationTypes</string>
<null/>
</entry>
<entry>
<string>corpus</string>
<null/>
</entry>
<entry>
<string>keepOriginalMarkupsAS</string>
<boolean>true</boolean>
</entry>
<entry>
<string>setsToRemove</string>
<null/>
</entry>
</localMap> …Run Code Online (Sandbox Code Playgroud) .net ×3
c# ×3
nhibernate ×2
unit-testing ×2
xml ×2
.net-core ×1
ado.net ×1
asp.net-core ×1
azure ×1
database ×1
nuget ×1
powershell ×1
sql-server ×1
teamcity ×1
timeout ×1
vb.net ×1
xpath ×1
xslt ×1
xunit.net ×1