【发布时间】:2019-02-28 23:25:33
【问题描述】:
我一直致力于实现一个 .NET Core API,使用 Neo4J 作为数据存储和 Neo4JClient (https://github.com/Readify/Neo4jClient) 来构建应用程序的数据层。事情进展得很顺利,但我不知道如何使用客户端测试方法,以充分验证代码正在执行预期的操作。
使用 Neo4JClient 的示例方法:
private readonly IGraphClient _graphClient;
protected IGraphClient GraphClient => _graphClient;
public BaseRepository(GraphClient client)
{
_graphClient = client;
_graphClient.Connect();
}
public async Task<IList<TModel>> GetAllAsync()
{
var results = await GraphClient.Cypher.Match($"(e:{typeof(TModel).Name})")
.Return(e => e.As<TModel>())
.ResultsAsync;
return results.ToList();
}
是否有像这样在GraphClient 上运行的模拟和单元测试方法的现有文档?我无法在 Google 搜索中找到有关该主题的任何内容。
【问题讨论】:
标签: c# unit-testing neo4j .net-core neo4jclient