小编Jas*_*son的帖子

Delphi接口通用功能 - 有没有解决方法?

我有以下代码

IProxy<T> = interface
  ['{1E3A98C5-78BA-4D65-A4BA-B6992B8B4783}']
  function Setup : ISetup<T>;
  function Proxy : T;
  function CastAs<I : IInterface> : IInterface;
end;
Run Code Online (Sandbox Code Playgroud)

有没有办法解决编译时收到的编译器错误?

"[DCC错误] Delphi.Mocks.pas(123):E2535接口方法必须没有参数化方法"

基本上我想通过传递类型转换为并返回该类型来传递此接口并能够抛弃它.我可以用一个类实现这个,但是更喜欢绕过一个接口.

附加信息:

说我有以下课程

TInterfaceProxy<T> = class(TBaseProxy<T>)
private type
  TProxyVirtualInterface = class(TVirtualInterface)
  private
    FProxy : TInterfaceProxy<T>;
  protected
  public
    function QueryInterface(const IID: TGUID; out Obj): HRESULT; override; stdcall;
    constructor Create(AProxy : TInterfaceProxy<T>; AInterface: Pointer; InvokeEvent: TVirtualInterfaceInvokeEvent);
  end;
private
  FVirtualInterfaces : TDictionary<TGUID, TProxyVirtualInterface>;
protected
  function InternalQueryInterface(const IID: TGUID; out Obj): HRESULT; stdcall;
  function QueryInterface(const IID: TGUID; out Obj): HRESULT; override; …
Run Code Online (Sandbox Code Playgroud)

delphi generics interface

10
推荐指数
2
解决办法
4262
查看次数

TFS workfold/unmap"存在多个工作空间,名称为XYZ"

我想了解如何解决以下情况.

我有一个TFS 2012服务器有三个集合,比如说;

- http://tfs2012:8080/tfs/DefaultCollection/
- http://tfs2012:8080/tfs/CollectionOne/
- http://tfs2012:8080/tfs/CollectionTwo/
Run Code Online (Sandbox Code Playgroud)

在CollectionOne和CollectionTwo中,我有一个同名的工作区,我们称之为"TestWorkspace".

当我在CollectionOne上为该工作区运行map命令时,它可以完美地工作(可以获取,删除,更新等).问题出现在我尝试取消映射工作区时,因为我使用它(想想构建机器),以下调用失败.

tf.exe workfold /unmap /workspace:TestWorkspace E:\Temp
Run Code Online (Sandbox Code Playgroud)

它失败了;

Multiple workspaces exist with the name TestWorkspace.
Please specify the Team Foundation Server or qualify the name with the owner.
Run Code Online (Sandbox Code Playgroud)

因此我尝试以下方法;

tf.exe workfold /unmap /workspace:TestWorkspace E:\Temp /collection:http://tfs2012:8080/tfs/CollectionOne/
Run Code Online (Sandbox Code Playgroud)

哪个失败了以下;

The option collection is not allowed. 
Run Code Online (Sandbox Code Playgroud)

同时指定workpsace的所有者也没有帮助,因为它们归同一个用户所有.

如何取消映射两个或多个集合中存在的工作空间?

tfs tf-cli tfs2012

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

WinAppDriver - 如何获取元素上可用的属性列表

我正在使用带有 WinAppDriver 的 Appium 来控制 WinForms/WPF 应用程序。

我正在寻找一种编程方式来获取已检索元素上可用的属性列表。

我目前的想法是要求 className 并使用它来查找我预先配置的属性的静态字典。

var element = driver.FindElementByXPath(xPath);

var properties = element.getProperties();    // Is there something I can call here?

Run Code Online (Sandbox Code Playgroud)

windows wpf appium winappdriver

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

NUnit 3.x-用于后代测试类的TestCaseSource

我目前有一组单元测试,这些单元测试与多个Rest API端点一致。像这样定义类。

public abstract class GetAllRouteTests<TModel, TModule>
{
  [Test]
  public void HasModels_ReturnsPagedModel()
  {
     // Implemented test
  }
}
Run Code Online (Sandbox Code Playgroud)

实施的测试夹具看起来像:

[TestFixture(Category = "/api/route-to-test")]
public GetAllTheThings : GetAllRouteTests<TheThing, ModuleTheThings> { }
Run Code Online (Sandbox Code Playgroud)

这使我能够跨所有GET all / list路由运行许多通用测试。这也意味着我拥有直接链接到要测试的模块的类,以及Resharper / Visual Studio / CI中“测试正常”的测试与代码之间的链接。

挑战在于某些路线需要查询参数来测试通过路线代码的其他路径。

例如/ api / route-to-test?category = big。

由于[TestCaseSource]需要静态字段,属性或方法,因此似乎没有很好的方法来覆盖要传递的查询字符串列表。我想出的最接近的东西似乎是hack。即:

public abstract class GetAllRouteTests<TModel, TModule>
{
  [TestCaseSource("StaticToDefineLater")]
  public void HasModels_ReturnsPagedModel(dynamic args)
  {
     // Implemented test
  }
}

[TestFixture(Category = "/api/route-to-test")]
public GetAllTheThings : GetAllRouteTests<TheThing, ModuleTheThings> 
{
    static IEnumerable<dynamic> StaticToDefineLater() 
    {
       // yield return all …
Run Code Online (Sandbox Code Playgroud)

c# nunit unit-testing

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

标签 统计

appium ×1

c# ×1

delphi ×1

generics ×1

interface ×1

nunit ×1

tf-cli ×1

tfs ×1

tfs2012 ×1

unit-testing ×1

winappdriver ×1

windows ×1

wpf ×1