一键导入
downstream-api-contract-tests
Verify ASP.NET Web services build the right IDownstreamApi route and payload without standing up HTTP
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Verify ASP.NET Web services build the right IDownstreamApi route and payload without standing up HTTP
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Authorization Code Flow for web applications using MSAL.NET confidential client to sign in users and access APIs on their behalf
Handle MSAL distributed token cache collisions and stale entries in ASP.NET Core applications
On-Behalf-Of (OBO) Flow for web APIs to call downstream APIs while preserving user identity in MSAL.NET
{what this skill teaches agents}
Review API DTO implementations for contract/domain separation, mapping patterns, and REST compliance
This skill should be used when the user asks to "build a feature", "fix a bug", "implement something", "start a dev cycle", types "/dev", or describes a software task that requires design, implementation, testing, and shipping. Orchestrates the full software development lifecycle from interrogation through shipping, with self-learning that improves over time.
| name | downstream-api-contract-tests |
| description | Verify ASP.NET Web services build the right IDownstreamApi route and payload without standing up HTTP |
| domain | testing |
| confidence | high |
| source | earned (Issue #708 service coverage audit) |
In this repo, MVC controller tests often mock the service layer, and API tests start at the API controller. That can leave a blind spot in the middle: the Web service that calls IDownstreamApi.
For a service method that calls IDownstreamApi, instantiate the real service with Mock<IDownstreamApi> and inspect mock.Invocations after the call.
var api = new Mock<IDownstreamApi>();
var sut = new EngagementService(api.Object);
await sut.AddPlatformToEngagementAsync(42, 7, "@tank");
var invocation = api.Invocations.Should().ContainSingle().Subject;
invocation.Arguments[0].Should().Be("JosephGuadagnoBroadcastingApi");
var request = invocation.Arguments[1];
request!.GetType().GetProperty("SocialMediaPlatformId")!.GetValue(request).Should().Be(7);
request.GetType().GetProperty("Handle")!.GetValue(request).Should().Be("@tank");
var configure = invocation.Arguments[2]
.Should().BeAssignableTo<Action<DownstreamApiOptionsReadOnlyHttpMethod>>().Subject;
var options = new DownstreamApiOptionsReadOnlyHttpMethod(new DownstreamApiOptions(), HttpMethod.Post.Method);
configure(options);
options.RelativePath.Should().Be("/engagements/42/platforms");
IServiceThis catches contract bugs that controller tests and API tests both miss, while staying fast and isolated. It is especially useful for anonymous request payloads where the shape matters but there is no dedicated DTO type in the Web project.