33using System . Threading . Tasks ;
44using Contentstack . Management . Core . Exceptions ;
55using Contentstack . Management . Core . Models ;
6+ using Contentstack . Management . Core . Queryable ;
67using Contentstack . Management . Core . Tests . Helpers ;
78using Contentstack . Management . Core . Tests . Model ;
89using Microsoft . VisualStudio . TestTools . UnitTesting ;
@@ -19,9 +20,9 @@ public class Contentstack005_BranchTest
1920 private static string _createdBranchUidAsync ;
2021
2122 private const string SourceBranch = "main" ;
22- private const string TestBranchUid = "dotnet-sdk-int-test-branch" ;
23- private const string TestBranchUidAsync = "dotnet-sdk-int-test-branch-async" ;
24- private const string NonExistentBranchUid = "blt00000000nonexistent00 " ;
23+ private const string TestBranchUid = "dotnet_int_br" ; // max 15 chars, alphanumeric+underscore
24+ private const string TestBranchUidAsync = "dotnet_int_br_a" ; // max 15 chars, alphanumeric+underscore
25+ private const string NonExistentBranchUid = "dotnet_no_br " ;
2526
2627 [ ClassInitialize ]
2728 public static void ClassInitialize ( TestContext context )
@@ -48,7 +49,9 @@ public static void ClassCleanup()
4849 private static void TryDeleteBranch ( string uid )
4950 {
5051 if ( string . IsNullOrEmpty ( uid ) ) return ;
51- try { _stack . Branch ( uid ) . Delete ( ) ; } catch { }
52+ var force = new ParameterCollection ( ) ;
53+ force . Add ( "force" , true ) ;
54+ try { _stack . Branch ( uid ) . Delete ( force ) ; } catch { }
5255 }
5356
5457 // ---- Query tests -------------------------------------------------------
@@ -230,7 +233,9 @@ public void Test010_Should_Delete_Branch()
230233 Assert . Inconclusive ( "Test004 did not create branch — skipping." ) ;
231234 try
232235 {
233- ContentstackResponse response = _stack . Branch ( _createdBranchUid ) . Delete ( ) ;
236+ var force = new ParameterCollection ( ) ;
237+ force . Add ( "force" , true ) ;
238+ ContentstackResponse response = _stack . Branch ( _createdBranchUid ) . Delete ( force ) ;
234239 var json = response . OpenJsonObjectResponse ( ) ;
235240 AssertLogger . IsNotNull ( json , "response" ) ;
236241 _createdBranchUid = null ;
@@ -250,7 +255,9 @@ public async Task Test011_Should_Delete_Branch_Async()
250255 Assert . Inconclusive ( "Test005 did not create branch — skipping." ) ;
251256 try
252257 {
253- ContentstackResponse response = await _stack . Branch ( _createdBranchUidAsync ) . DeleteAsync ( ) ;
258+ var force = new ParameterCollection ( ) ;
259+ force . Add ( "force" , true ) ;
260+ ContentstackResponse response = await _stack . Branch ( _createdBranchUidAsync ) . DeleteAsync ( force ) ;
254261 var json = response . OpenJsonObjectResponse ( ) ;
255262 AssertLogger . IsNotNull ( json , "response" ) ;
256263 _createdBranchUidAsync = null ;
@@ -399,7 +406,7 @@ public void Test023_Should_Fail_Create_With_Invalid_Source_Branch()
399406 TestOutputLogger . LogContext ( "TestScenario" , "Branch_Create_InvalidSource_Sync" ) ;
400407 var model = new BranchModel
401408 {
402- Uid = "dotnet-sdk-invalid-src-test " ,
409+ Uid = "dotnet_inv_src " ,
403410 Source = "non_existent_source_branch_99999"
404411 } ;
405412 try
@@ -420,7 +427,7 @@ public async Task Test024_Should_Fail_CreateAsync_With_Invalid_Source_Branch()
420427 TestOutputLogger . LogContext ( "TestScenario" , "Branch_Create_InvalidSource_Async" ) ;
421428 var model = new BranchModel
422429 {
423- Uid = "dotnet-sdk-invalid-src-async " ,
430+ Uid = "dotnet_inv_a " ,
424431 Source = "non_existent_source_branch_88888"
425432 } ;
426433 try
0 commit comments