Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@
- Migrated `LocaleModel` and `BulkOperationModels` to use `System.Text.Json` attributes
- Added/updated unit and integration test coverage for Locale and Bulk Operations
- Upgraded target framework to .NET 10 and removed all build warnings
- **Note**:
- This is a beta release and APIs/modules may continue evolving during migration stabilization
- Release and Workflow setup within Bulk Operations module are currently commented out and will be uncommented once the Release and Workflow modules are migrated to System.Text.Json
- Remaining modules migrated and re-enabled — `AuditLog`, `Extension`, `Label`, `Role`, `Taxonomy`, `Term`, `Webhook`, `DeliveryToken`, `ManagementToken`, and `CustomExtension` fully re-enabled with STJ attributes; all corresponding `Stack.*()` accessor methods restored
- All `[JsonProperty]` replaced with `[JsonPropertyName]` across all model classes; `[JsonObject(ItemNullValueHandling)]` removed in favour of global `DefaultIgnoreCondition = WhenWritingNull`
- OAuth module enabled — `OAuthHandler`, `OAuthTokenService`, `OAuthAppAuthorizationService`, and `OAuthAppRevocationService` now active; auto token refresh wired into `InvokeAsync` pipeline via `EnsureOAuthTokenIsValidAsync`
- CustomWidgetModel scope serialization migrated from `JsonTextWriter` to `System.Text.Json.JsonSerializer.Serialize()`
- Asset extension upload tests — 3 previously skipped tests (`Test002_Should_Create_Dashboard`, `Test003_Should_Create_Custom_Widget`, `Test004_Should_Create_Custom_field`) now have real implementations
- Unit test coverage expanded — 991 → 1,242 passing tests; 24 previously excluded test files re-enabled covering AuditLog, Extension, Label, Role, Taxonomy, Term, Webhook, DeliveryToken, CustomExtension, and all infrastructure tests (HTTP pipeline, converters, runtime contexts, utilities)
- Integration test coverage expanded — 4 previously excluded integration test files re-enabled: ContentType Expanded (`Contentstack012b`), DeliveryToken (`Contentstack016`), Taxonomy (`Contentstack017`), Role (`Contentstack019`)

## [v0.10.0](https://github.com/contentstack/contentstack-management-dotnet/tree/v0.9.0)
- Feat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,4 @@
<ProjectReference Include="..\Contentstack.Management.Core\contentstack.management.core.csproj" />
</ItemGroup>

<ItemGroup>
<!-- Exclude out-of-scope integration tests (still use Newtonsoft or depend on excluded SDK types) -->
<!-- Contentstack004_ReleaseTest.cs - RE-ENABLED for Release module STJ migration -->
<!-- Contentstack015_BulkOperationTest.cs - RE-ENABLED (Stack.Release() and Stack.Workflow() now active) -->
<!-- Contentstack020_WorkflowTest.cs - RE-ENABLED for Workflow module STJ migration -->
<Compile Remove="IntegrationTest\Contentstack012b_ContentTypeExpandedIntegrationTest.cs" />
<Compile Remove="IntegrationTest\Contentstack016_DeliveryTokenTest.cs" />
<Compile Remove="IntegrationTest\Contentstack017_TaxonomyTest.cs" />
<Compile Remove="IntegrationTest\Contentstack019_RoleTest.cs" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Net;
using System.Threading.Tasks;
using Contentstack.Management.Core.Models;
using Contentstack.Management.Core.Models.CustomExtension;
using Contentstack.Management.Core.Models.Fields;
using Contentstack.Management.Core.Tests.Helpers;
using Contentstack.Management.Core.Tests.Model;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.Threading.Tasks;
using System.Text;
using Contentstack.Management.Core.Models;
using Contentstack.Management.Core.Models.CustomExtension;
using Contentstack.Management.Core.Tests.Helpers;
using Contentstack.Management.Core.Tests.Model;
using Contentstack.Management.Core.Exceptions;
Expand Down Expand Up @@ -404,32 +405,92 @@ public async Task Test001_Should_Create_Asset()
}
}

// Tests 002-004 depend on Extension/CustomExtension SDK module (excluded from current scope)
[TestMethod]
[DoNotParallelize]
[Ignore("Requires Extension SDK module (Models/CustomExtension) which is out of current scope")]
public async Task Test002_Should_Create_Dashboard()
{
Assert.Inconclusive("Extension SDK module not available in current scope.");
await System.Threading.Tasks.Task.CompletedTask;
TestOutputLogger.LogContext("TestScenario", "CreateDashboardWidget");
var path = Path.Combine(System.Environment.CurrentDirectory, "../../../Mock/extension.html");
try
{
DashboardWidgetModel dashboard = new DashboardWidgetModel(
path, "text/html", "Integration Test Dashboard",
isEnable: true, defaultWidth: "half", tags: "dashboard,test");
ContentstackResponse response = await _stack.Extension().UploadAsync(dashboard);
TestOutputLogger.LogContext("StackAPIKey", _stack?.APIKey ?? "null");

if (response.IsSuccessStatusCode)
{
AssertLogger.IsNotNull(response.OpenJsonObjectResponse()["extension"], "CreateDashboard_ResponseContainsExtension");
}
else
{
AssertLogger.Fail("Dashboard Widget Creation Failed", response.OpenResponse());
}
}
catch (Exception e)
{
AssertLogger.Fail("Dashboard Widget Creation Failed", e.Message);
}
}

[TestMethod]
[DoNotParallelize]
[Ignore("Requires Extension SDK module (Models/CustomExtension) which is out of current scope")]
public async Task Test003_Should_Create_Custom_Widget()
{
Assert.Inconclusive("Extension SDK module not available in current scope.");
await System.Threading.Tasks.Task.CompletedTask;
TestOutputLogger.LogContext("TestScenario", "CreateCustomWidget");
var path = Path.Combine(System.Environment.CurrentDirectory, "../../../Mock/extension.html");
try
{
var scope = new ExtensionScope { ContentTypes = new List<string> { "$all" } };
CustomWidgetModel widget = new CustomWidgetModel(
path, "text/html", "Integration Test Widget",
tags: "widget,test", scope: scope);
ContentstackResponse response = await _stack.Extension().UploadAsync(widget);
TestOutputLogger.LogContext("StackAPIKey", _stack?.APIKey ?? "null");

if (response.IsSuccessStatusCode)
{
AssertLogger.IsNotNull(response.OpenJsonObjectResponse()["extension"], "CreateCustomWidget_ResponseContainsExtension");
}
else
{
AssertLogger.Fail("Custom Widget Creation Failed", response.OpenResponse());
}
}
catch (Exception e)
{
AssertLogger.Fail("Custom Widget Creation Failed", e.Message);
}
}

[TestMethod]
[DoNotParallelize]
[Ignore("Requires Extension SDK module (Models/CustomExtension) which is out of current scope")]
public async Task Test004_Should_Create_Custom_field()
{
Assert.Inconclusive("Extension SDK module not available in current scope.");
await System.Threading.Tasks.Task.CompletedTask;
TestOutputLogger.LogContext("TestScenario", "CreateCustomField");
var path = Path.Combine(System.Environment.CurrentDirectory, "../../../Mock/extension.html");
try
{
CustomFieldModel field = new CustomFieldModel(
path, "text/html", "Integration Test Field",
dataType: "text", isMultiple: false, tags: "field,test");
ContentstackResponse response = await _stack.Extension().UploadAsync(field);
TestOutputLogger.LogContext("StackAPIKey", _stack?.APIKey ?? "null");

if (response.IsSuccessStatusCode)
{
AssertLogger.IsNotNull(response.OpenJsonObjectResponse()["extension"], "CreateCustomField_ResponseContainsExtension");
}
else
{
AssertLogger.Fail("Custom Field Creation Failed", response.OpenResponse());
}
}
catch (Exception e)
{
AssertLogger.Fail("Custom Field Creation Failed", e.Message);
}
}

private string _testAssetUid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3664,7 +3664,7 @@ private async Task CreateTestRelease()
if (response.IsSuccessStatusCode && responseJson["release"] != null)
_testReleaseUid = responseJson["release"]["uid"].ToString();
}
catch (Exception e) { }
catch (Exception) { }
await Task.CompletedTask;
}

Expand Down
Loading
Loading