我正在尝试编写一个自定义的Fluent断言等效步骤,以将Enum主题侧的值与异常侧的字符串进行比较。
我似乎要面对的问题是,传递给的主题类型在调用IEquivalencyStepmy之前已经转换为字符串EquivalencyStep。
流畅的断言中是否发生了一些魔术,试图将枚举直接转换为字符串?
代码示例如下:
public class SubjectClass
{
public EnumType Prop1 { get; set; }
}
public enum EnumType
{
A,
B,
C
}
public class ExpectionClass
{
public string Prop1 { get; set; }
}
[TestFixture]
public class ComparingEnumWithTests
{
[Test]
public void Test()
{
var expection = new ExpectionClass() {Prop1 = "bbb"};
var subject = new SubjectClass() {Prop1 = EnumType.B};
subject.ShouldBeEquivalentTo(expection, opt => opt.Using(new ComparingEnumWith<EnumType>(new Dictionary<string, EnumType>()
{
{"aaa", EnumType.A },
{"bbb", …Run Code Online (Sandbox Code Playgroud) 我想弄清楚是否有办法以自动化的方式打包 aws 无服务器项目,以便我们可以拆分构建和发布管道。
使用dotnet lambda命令行工具,我可以看到有一个dotnet lambda package命令可以将 lambda 打包为准备部署的 .zip 文件。但是我找不到任何可以打包整个无服务器应用程序的东西。
这可能吗?如果是这样我运行什么命令?
我们在 VSTS 上运行 Build 和 Release 管道,但是我真的不认为我有任何区别,只要我可以编写脚本。
我试图弄清楚是否可以使用CloudFormation创建DynamoDB表,但使用Restption at Rest.
我设法找到了以下开发指南,但它只是告诉您如何使用控制台和AWS CLI创建表:https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/encryption.tutorial. HTML
从看的SDK看来你需要在设置属性SSEEnabled上SSESpecification到true但这可以走在cloudformation模板?如果有的话?
我有一个 Dockerfile,它从microsoft/dotnet:2.0-runtime. 当我在本地(在运行 Linux 容器的 Windows 上)进行构建时,我会得到一个 Linux docker 映像。
但是,如果我们使用 2017 托管代理在 VSTS 上运行相同的构建过程,那么我们将获得 Windows docker 映像。
是否可以在 VSTS 2017 托管代理上构建 Linux docker 映像而无需使用 Linux 构建代理?
尝试在 terraform 脚本上执行计划或应用时出现以下错误。
Error: Invalid count argument
on main.tf line 157, in resource "azurerm_sql_firewall_rule" "sqldatabase_onetimeaccess_firewall_rule":
157: count = length(split(",", azurerm_app_service.app_service.possible_outbound_ip_addresses))
The "count" value depends on resource attributes that cannot be determined
until apply, so Terraform cannot predict how many instances will be created.
To work around this, use the -target argument to first apply only the
resources that the count depends on.
Run Code Online (Sandbox Code Playgroud)
我知道这会失败,因为在创建 app_service 之前它不知道要创建的防火墙规则的数量。我可以使用apply参数运行,-target=azurerm_app_service.app_service然后在创建 app_service 后运行另一个应用。
然而,这对于我们的 CI 流程来说并不是很好,如果我们想从 terraform 脚本创建一个全新的环境,我们只想告诉 terraform 去构建它,而不必告诉它每个目标按顺序构建。
terraform 中是否有一种方法可以只说按顺序构建所需的所有内容,而无需添加目标? …
我目前正在尝试在装饰器中包装一个类,并在运行时注入其中一个依赖项。我目前有一个由 a和 aIStorage实现的接口。接受a和Context` 对象。然而,每次解析这些类时都需要传入上下文对象。StorageCacheDecoratorStorageStorageCacheDecoratorIStorageStorage object takes in a
public interface IStorage
{
}
public class Storage : IStorage
{
public Context Context { get; }
public Storage(Context context)
{
this.Context = context;
}
}
public class StorageCacheDecorator : IStorage
{
public IStorage InnerStorage { get; }
public StorageCacheDecorator(IStorage innerStorage)
{
this.InnerStorage = innerStorage;
}
}
public class Context
{
}
Run Code Online (Sandbox Code Playgroud)
我省略了实现细节,下面的测试给出了我的问题的示例
[Test]
public void ShouldResolveWithCorrectContext()
{
var context = new Context();
var …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用给定的分区键和排序键的范围查询 dynamodb 表,但 API 不断抛出以下错误:
Amazon.DynamoDBv2.AmazonDynamoDBException KeyConditionExpressions 每个键只能包含一个条件
这是用于创建请求的 C# 代码:
var partitionKey = 10;
var from = DateTime.NowUtc.AddDays(-1);
var to = DateTime.NowUtc;
var queryRequest = new QueryRequest
{
TableName = _tableName,
IndexName = "index",
KeyConditionExpression = "#pkey = :v_pkey and #skey >= :v_from and #skey <= :v_to",
ExpressionAttributeNames = {
{"#pkey", "PartitionKey"},
{"#skey", "SortKey"}
},
ExpressionAttributeValues = {
{":v_pkey", new AttributeValue { N = partitionKey.ToString(CultureInfo.InvariantCulture) }},
{":v_from", new AttributeValue { N = new DateTimeOffset(from).ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture) }},
{":v_to", new AttributeValue { …Run Code Online (Sandbox Code Playgroud) c# ×4
.net ×1
.net-core ×1
aws-lambda ×1
azure-devops ×1
docker ×1
docker-build ×1
linux ×1
terraform ×1