원클릭으로
testing
Use for MSTest projects, unit vs integration tests, coverlet/TRX output, and local credentials in contentstack-management-dotnet.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use for MSTest projects, unit vs integration tests, coverlet/TRX output, and local credentials in contentstack-management-dotnet.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use when reviewing or preparing a pull request for contentstack-management-dotnet.
Use for branches, CI, build/test scripts, and NuGet release flow in contentstack-management-dotnet.
Use for the contentstack.management.aspnetcore package, HttpClient/DI registration with ASP.NET Core.
Use when changing or using the CMA client API, authentication, or NuGet package surface for Contentstack.Management.Core.
Use for C# language level, nullable usage, and file/folder layout consistent with Contentstack.Management.Core.
Use when building or updating DocFX API documentation under docfx_project for this repository.
| name | testing |
| description | Use for MSTest projects, unit vs integration tests, coverlet/TRX output, and local credentials in contentstack-management-dotnet. |
appsettings.json for integration tests.| Project | Path | Purpose |
|---|---|---|
| Unit tests | Contentstack.Management.Core.Unit.Tests/ | Fast, isolated tests; this is what CI runs via Scripts/run-unit-test-case.sh. |
| Integration tests | Contentstack.Management.Core.Tests/ | Real API tests under IntegrationTest/; requires credentials. |
Microsoft.VisualStudio.TestTools.UnitTesting).net7.0 for both test projects.coverlet.collector with --collect:"XPlat code coverage" in the unit test script.From repo root:
sh ./Scripts/run-unit-test-case.sh
Contentstack.Management.Core.Unit.Tests/TestResults/Report-Contentstack-DotNet-Test-Case.trx (logger file name in script).Contentstack.Management.Core.Unit.Tests/TestResults before running.Contentstack.Management.Core.Tests/Contentstack.cs loads appsettings.json via ConfigurationBuilder and exposes Contentstack.CreateAuthenticatedClient() (login using credentials from config—never commit real secrets).appsettings.json locally (it is not checked in; keep secrets out of git). Structure includes Contentstack section and nested Contentstack:Credentials, Contentstack:Organization as used by the tests.[ClassInitialize] / [DoNotParallelize] in many classes; follow existing patterns when adding scenarios.TestResults archives, or credential files.Mokes/ / Mock/ usage in unit tests).This repo uses MSTest (Microsoft.VisualStudio.TestTools.UnitTesting), not xUnit. Many tests also use AutoFixture, AutoFixture.AutoMoq, and Moq.
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Contentstack.Management.Core.Unit.Tests.YourArea
{
[TestClass]
public class YourFeatureTest
{
[TestInitialize]
public void Setup()
{
// Per-test setup
}
[TestMethod]
public void YourScenario_DoesExpectedThing()
{
Assert.IsNotNull(result);
}
}
}
Common in HTTP and service tests (ContentstackHttpRequestTest.cs):
using AutoFixture;
using AutoFixture.AutoMoq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class YourFeatureTest
{
private readonly IFixture _fixture = new Fixture()
.Customize(new AutoMoqCustomization());
[TestMethod]
public void Example()
{
var value = _fixture.Create<string>();
Assert.IsFalse(string.IsNullOrEmpty(value));
}
}
Pipeline tests often build ExecutionContext, RequestContext, ResponseContext, attach a RetryPolicy, and use test doubles from Mokes/ (e.g. MockHttpHandlerWithRetries, MockService). See RetryHandlerTest.cs.
Integration tests live in Contentstack.Management.Core.Tests, use [ClassInitialize], [DoNotParallelize] in many classes, and Contentstack.CreateAuthenticatedClient() from Contentstack.cs. Do not use this pattern in the unit test project for network I/O.
sh ./Scripts/run-unit-test-case.sh from repo root.dotnet test Contentstack.Management.Core.Unit.Tests/Contentstack.Management.Core.Unit.Tests.csprojExact dotnet test arguments are in Scripts/run-unit-test-case.sh.