44using Gotenberg . Sharp . API . Client . Domain . Settings ;
55using Gotenberg . Sharp . API . Client . Domain . ValueObjects ;
66using Gotenberg . Sharp . API . Client . Extensions ;
7+ using Gotenberg . Sharp . API . Client . Infrastructure ;
78using Microsoft . Extensions . DependencyInjection ;
89
910namespace GotenbergSharpClient . Tests ;
@@ -19,7 +20,6 @@ public void PdfPassword_Create_WithValidPassword_ReturnsInstance()
1920 var password = PdfPassword . Create ( "secret123" ) ;
2021
2122 password . Value . Should ( ) . Be ( "secret123" ) ;
22- password . ToString ( ) . Should ( ) . Be ( "secret123" ) ;
2323 }
2424
2525 [ TestCase ( null ) ]
@@ -43,12 +43,11 @@ public void PdfPassword_Equality_WithSameValue_ReturnsTrue()
4343 }
4444
4545 [ Test ]
46- public void PdfPassword_ImplicitConversion_ToStringReturnsValue ( )
46+ public void PdfPassword_ToString_ReturnsRedactedValue ( )
4747 {
48- PdfPassword password = PdfPassword . Create ( "secret" ) ;
49- string result = password ;
48+ var password = PdfPassword . Create ( "secret" ) ;
5049
51- result . Should ( ) . Be ( "secret " ) ;
50+ password . ToString ( ) . Should ( ) . Be ( "**** " ) ;
5251 }
5352
5453 #endregion
@@ -115,7 +114,7 @@ public async Task UserPassword_SerializesToCorrectHttpContent()
115114
116115 var httpContents = options . ToHttpContent ( ) . ToList ( ) ;
117116 var content = httpContents . FirstOrDefault ( c =>
118- c . Headers . ContentDisposition ? . Name == "userPassword" ) ;
117+ c . Headers . ContentDisposition ? . Name == Constants . Gotenberg . PdfOutput . UserPassword ) ;
119118
120119 content . Should ( ) . NotBeNull ( ) ;
121120 ( await content ! . ReadAsStringAsync ( ) ) . Should ( ) . Be ( "openme" ) ;
@@ -131,7 +130,7 @@ public async Task OwnerPassword_SerializesToCorrectHttpContent()
131130
132131 var httpContents = options . ToHttpContent ( ) . ToList ( ) ;
133132 var content = httpContents . FirstOrDefault ( c =>
134- c . Headers . ContentDisposition ? . Name == "ownerPassword" ) ;
133+ c . Headers . ContentDisposition ? . Name == Constants . Gotenberg . PdfOutput . OwnerPassword ) ;
135134
136135 content . Should ( ) . NotBeNull ( ) ;
137136 ( await content ! . ReadAsStringAsync ( ) ) . Should ( ) . Be ( "editme" ) ;
@@ -145,9 +144,9 @@ public void NullPasswords_NotIncludedInHttpContent()
145144 var httpContents = options . ToHttpContent ( ) . ToList ( ) ;
146145
147146 httpContents . FirstOrDefault ( c =>
148- c . Headers . ContentDisposition ? . Name == "userPassword" ) . Should ( ) . BeNull ( ) ;
147+ c . Headers . ContentDisposition ? . Name == Constants . Gotenberg . PdfOutput . UserPassword ) . Should ( ) . BeNull ( ) ;
149148 httpContents . FirstOrDefault ( c =>
150- c . Headers . ContentDisposition ? . Name == "ownerPassword" ) . Should ( ) . BeNull ( ) ;
149+ c . Headers . ContentDisposition ? . Name == Constants . Gotenberg . PdfOutput . OwnerPassword ) . Should ( ) . BeNull ( ) ;
151150 }
152151
153152 #endregion
0 commit comments