小编Ran*_*anj的帖子

Jenkins集成了dotnet测试

我正在使用dotnet测试对dotnet核心库进行单元测试.我像这样对我的Jenkins奴隶进行测试.

dotnet test test/Turbine.Domain.UnitTest -xml mstest-reports/Turbine.Domain.UnitTest.xml
Run Code Online (Sandbox Code Playgroud)

测试报告看起来像这样.

<?xml version="1.0" encoding="utf-8"?>
<assemblies>
  <assembly name="Turbine.Domain.UnitTest.dll" environment="64-bit .NET (unknown version) [collection-per-class, parallel (8 threads)]" test-framework="xUnit.net 2.1.0.3179" run-date="2017-04-07" run-time="13:34:31" total="31" passed="31" failed="0" skipped="0" time="0.170" errors="0">
    <errors />
    <collection total="3" passed="3" failed="0" skipped="0" name="Test collection for Turbine.Domain.Tests.AccumulatePositionsTests" time="0.052">
      <test name="Turbine.Domain.Tests.AccumulatePositionsTests.CanAccumulatePositionsByPortfolioIndex" type="Turbine.Domain.Tests.AccumulatePositionsTests" method="CanAccumulatePositionsByPortfolioIndex" time="0.0402475" result="Pass" />
      <test name="Turbine.Domain.Tests.AccumulatePositionsTests.LotEventsTriggerPositionEventsImmediately" type="Turbine.Domain.Tests.AccumulatePositionsTests" method="LotEventsTriggerPositionEventsImmediately" time="0.0102925" result="Pass" />
      <test name="Turbine.Domain.Tests.AccumulatePositionsTests.CanAccumulatePositionsByDefaultIndex" type="Turbine.Domain.Tests.AccumulatePositionsTests" method="CanAccumulatePositionsByDefaultIndex" time="0.0012357" result="Pass" />
    </collection>
    <collection total="4" passed="4" failed="0" skipped="0" name="Test collection for Turbine.Domain.Tests.Queries.AnalyticsSummaryTests" time="0.087">
      <test name="Turbine.Domain.Tests.Queries.AnalyticsSummaryTests.MarketValueHandlesNegativeAmounts" type="Turbine.Domain.Tests.Queries.AnalyticsSummaryTests" method="MarketValueHandlesNegativeAmounts" time="0.0826806" …
Run Code Online (Sandbox Code Playgroud)

jenkins .net-core

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

从命令行重新锐化

我想在许多解决方案中使用ReSharper Adjust Namespaces功能.我想通过创建一个使用ReSharper API的命令行应用程序来自动执行此过程.

我查看了ReSharper OpenAPI,但似乎是为了在活动的Visual Studio会话中使用ReSharper API.我希望能够从命令行使用ReSharper API.

这可能吗?

resharper

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

了解Reactive Extensions和CallContext

我有使用CallContext将会话信息传输到任务延续的代码.现在我已经介绍了Reactive Extensions的使用,我正在观察一些我想要了解的奇怪行为.

我有这个包含CallContext使用的帮助器类.

public static class TestContext
{
    private static readonly string _KEY = "my-context";

    public static int Value
    {
        get { return CallContext.LogicalGetData(_KEY) as int? ?? -1; }
        set { CallContext.LogicalSetData(_KEY, value); }
    }
}
Run Code Online (Sandbox Code Playgroud)

在我的main函数中,我使用interval创建了一个cold observable.在每个tick上,我投影上下文值以查看管道中存在的上下文.

var periodic = Observable.Interval(TimeSpan.FromMilliseconds(100), Scheduler.Default)
    .Select(_ => TestContext.Value)
    .Timestamp();
Run Code Online (Sandbox Code Playgroud)

在循环中,我将上下文设置为循环索引,然后使用LINQPad的DumpLatest方法订阅并转储序列.为了好玩,我在迭代结束时将上下文设置为不同的值(42).

for (int i = 0; i < 3; i++)
{
    TestContext.Value = i;
    periodic
        .DumpLatest(string.Format("Iteration {0}", i));
    TestContext.Value = 42;
}
Run Code Online (Sandbox Code Playgroud)

我希望每个订阅从订阅时间捕获上下文.我希望订阅通知与订阅迭代次数匹配.

当我的调度程序是Scheduler.Default时,这完全符合预期,如上面编码的那样.

使用Scheduler.Default

但是,如果我将调度程序更改为new EventLoopScheduler()所有订阅,请使用相同的上下文.

var periodic = Observable.Interval(TimeSpan.FromMilliseconds(100), new …
Run Code Online (Sandbox Code Playgroud)

.net system.reactive

5
推荐指数
0
解决办法
80
查看次数

使用graphql速记将字段标记为已弃用

我正在使用GraphQL速记来指定架构中的类型,例如

type Car {
  id: ID!
  make: String
  model: String
  description: String
}
Run Code Online (Sandbox Code Playgroud)

使用此速记,是否可以将字段标记为已弃用?假设我想将描述标记为已弃用。这是我对如何执行此操作的疯狂猜测。

type Car {
  id: ID!
  make: String
  model: String
  @deprecated
  description: String
}
Run Code Online (Sandbox Code Playgroud)

但是没有骰子。在GraphQL速记中可以实现字段弃用吗?

谢谢!

graphql

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

使用 IN 过滤 DynamoDB 查询

我正在尝试使用 IN 过滤器查询 DynamoDB 表。当我将单个值传递给 IN 时,我的查询有效,但是当我传递多个值时,我没有得到匹配项。

这是 params 对象的初始设置。

  var params = {
    TableName: "Interactions",
    IndexName: "environment-time-index",
    KeyConditionExpression: "#environment = :environment and #time between :start and :end",
    FilterExpression: "#product = :product",
    ExpressionAttributeNames: {
      "#product": "product",
      "#environment": "environment",
      "#time": "time"
    },
    ExpressionAttributeValues: {
      ":product": product,      
      ":environment": environment,
      ":start": start,
      ":end": end
    }
  };
Run Code Online (Sandbox Code Playgroud)

接下来,如果用户提供了一个确定的查询参数,我会像这样修改 params 对象。这是我使用 IN 运算符的地方。

  if (req.query.firm) {
    var firms = req.query.firm;
    console.log('debug', firms);
    params.FilterExpression += " AND #firmCode IN (:firms)";
    params.ExpressionAttributeNames["#firmCode"] = "firmCode";
    params.ExpressionAttributeValues[":firms"] = firms; …
Run Code Online (Sandbox Code Playgroud)

amazon-dynamodb

4
推荐指数
2
解决办法
6801
查看次数