@@ -845,7 +845,7 @@ public void FromFeedback_NoFeedbackContext_Throws()
845845 }
846846
847847 [ Fact ]
848- public void FromFeedback_MultipleAttachments_LogsWarning ( )
848+ public void FromFeedback_MultipleAttachments_AddsAll ( )
849849 {
850850 // Arrange
851851 var feedback = new SentryFeedback (
@@ -864,23 +864,46 @@ public void FromFeedback_MultipleAttachments_LogsWarning()
864864 Feedback = feedback
865865 }
866866 } ;
867- var logger = Substitute . For < IDiagnosticLogger > ( ) ;
868- logger . IsEnabled ( Arg . Any < SentryLevel > ( ) ) . Returns ( true ) ;
869-
870867 List < SentryAttachment > attachments = [
871868 AttachmentHelper . FakeAttachment ( "file1.txt" ) , AttachmentHelper . FakeAttachment ( "file2.txt" )
872869 ] ;
873870
874871 // Act
875- using var envelope = Envelope . FromFeedback ( evt , logger , attachments ) ;
872+ using var envelope = Envelope . FromFeedback ( evt , attachments : attachments ) ;
873+
874+ // Assert
875+ envelope . Items . Count ( item => item . TryGetType ( ) == EnvelopeItem . TypeValueAttachment ) . Should ( ) . Be ( 2 ) ;
876+ }
877+
878+ [ Fact ]
879+ public void FromFeedback_NullAttachment_Skipped ( )
880+ {
881+ // Arrange
882+ var feedback = new SentryFeedback (
883+ "Everything is great!" ,
884+ "foo@bar.com" ,
885+ "Someone Nice" ,
886+ "fake-replay-id" ,
887+ "https://www.example.com" ,
888+ SentryId . Create ( )
889+ ) ;
890+ var evt = new SentryEvent
891+ {
892+ Level = SentryLevel . Info ,
893+ Contexts =
894+ {
895+ Feedback = feedback
896+ }
897+ } ;
898+ List < SentryAttachment > attachments = [
899+ null ! , AttachmentHelper . FakeAttachment ( "file1.txt" )
900+ ] ;
901+
902+ // Act
903+ using var envelope = Envelope . FromFeedback ( evt , attachments : attachments ) ;
876904
877905 // Assert
878- logger . Received ( 1 ) . Log (
879- SentryLevel . Warning ,
880- Arg . Is < string > ( m => m . Contains ( "Feedback can only contain one attachment" ) ) ,
881- null ,
882- Arg . Any < object [ ] > ( ) ) ;
883- envelope . Items . Should ( ) . ContainSingle ( item => item . TryGetType ( ) == EnvelopeItem . TypeValueAttachment ) ;
906+ envelope . Items . Count ( item => item . TryGetType ( ) == EnvelopeItem . TypeValueAttachment ) . Should ( ) . Be ( 1 ) ;
884907 }
885908
886909 [ Fact ]
0 commit comments