@@ -27,6 +27,36 @@ public LibraryTest(ITestOutputHelper output, PlexFixture fixture)
2727 this . plexAccountClient = fixture . ServiceProvider . GetService < IPlexAccountClient > ( ) ;
2828 }
2929
30+ [ Fact ]
31+ public async void Test_CreateCollectionThenDeleteCollection ( )
32+ {
33+ var itemsToAddToCollection = new string [ ] { "349591" , "350758" , "343369" } ;
34+ var collectionName = "Test_Full_Cycle" ;
35+ var libraryKey = "1" ;
36+ //
37+ // foreach (var item in itemsToAddToCollection)
38+ // {
39+ // await this.plexLibraryClient.AddCollectionToLibraryItemAsync(this.config.AuthenticationKey,
40+ // this.config.Host, libraryKey, item, collectionName);
41+ // }
42+
43+ var itemsAfterAdd = await this . plexLibraryClient . GetCollectionItemsByCollectionName ( this . config . AuthenticationKey , this . config . Host ,
44+ libraryKey , collectionName ) ;
45+
46+ Assert . Equal ( itemsToAddToCollection . Length , itemsAfterAdd . Size ) ;
47+
48+ foreach ( var item in itemsAfterAdd . Media )
49+ {
50+ await this . plexLibraryClient . DeleteCollectionFromLibraryItemAsync ( this . config . AuthenticationKey ,
51+ this . config . Host , libraryKey , item . RatingKey , collectionName ) ;
52+ }
53+
54+ var itemsAfterDelete = await this . plexLibraryClient . GetCollectionItemsByCollectionName ( this . config . AuthenticationKey , this . config . Host ,
55+ libraryKey , collectionName ) ;
56+
57+ Assert . Equal ( 0 , itemsAfterDelete . Size ) ;
58+ }
59+
3060 [ Fact ]
3161 public async void Test_GetCollectionItems ( )
3262 {
0 commit comments