@@ -1730,6 +1730,67 @@ public void CaptureFeedback_ConfigureScope_ScopeApplied(bool enabled)
17301730 _fixture . Client . Received ( enabled ? 1 : 0 ) . CaptureFeedback ( Arg . Any < SentryFeedback > ( ) , Arg . Is < Scope > ( s => s . Tags [ "foo" ] == "bar" ) , Arg . Any < SentryHint > ( ) ) ;
17311731 }
17321732
1733+ [ Theory ]
1734+ [ InlineData ( true ) ]
1735+ [ InlineData ( false ) ]
1736+ public void CaptureAttachment_HubEnabled ( bool enabled )
1737+ {
1738+ // Arrange
1739+ var hub = _fixture . GetSut ( ) ;
1740+ if ( ! enabled )
1741+ {
1742+ hub . Dispose ( ) ;
1743+ }
1744+
1745+ _fixture . Client . CaptureEnvelope ( Arg . Any < Envelope > ( ) ) . Returns ( true ) ;
1746+
1747+ var eventId = SentryId . Create ( ) ;
1748+ var attachment = new SentryAttachment (
1749+ AttachmentType . Default ,
1750+ new ByteAttachmentContent ( "test content"u8 . ToArray ( ) ) ,
1751+ "test.txt" ,
1752+ "text/plain" ) ;
1753+
1754+ // Act
1755+ var result = hub . CaptureAttachment ( eventId , attachment ) ;
1756+
1757+ // Assert
1758+ result . Should ( ) . Be ( enabled ) ;
1759+ _fixture . Client . Received ( enabled ? 1 : 0 ) . CaptureEnvelope ( Arg . Any < Envelope > ( ) ) ;
1760+ }
1761+
1762+ [ Fact ]
1763+ public void CaptureAttachment_SentryIdEmpty_ReturnsFalse ( )
1764+ {
1765+ // Arrange
1766+ var hub = _fixture . GetSut ( ) ;
1767+
1768+ var eventId = SentryId . Empty ;
1769+ var attachment = new SentryAttachment ( AttachmentType . Default , NullAttachmentContent . Instance , "test.txt" , "text/plain" ) ;
1770+
1771+ // Act
1772+ var result = hub . CaptureAttachment ( eventId , attachment ) ;
1773+
1774+ // Assert
1775+ result . Should ( ) . Be ( false ) ;
1776+ _fixture . Client . DidNotReceive ( ) . CaptureEnvelope ( Arg . Any < Envelope > ( ) ) ;
1777+ }
1778+
1779+ [ Fact ]
1780+ public void CaptureAttachment_AttachmentNull_ReturnsFalse ( )
1781+ {
1782+ // Arrange
1783+ var hub = _fixture . GetSut ( ) ;
1784+ var eventId = SentryId . Create ( ) ;
1785+
1786+ // Act
1787+ var result = hub . CaptureAttachment ( eventId , null ! ) ;
1788+
1789+ // Assert
1790+ result . Should ( ) . Be ( false ) ;
1791+ _fixture . Client . DidNotReceive ( ) . CaptureEnvelope ( Arg . Any < Envelope > ( ) ) ;
1792+ }
1793+
17331794 [ Theory ]
17341795 [ InlineData ( true ) ]
17351796 [ InlineData ( false ) ]
0 commit comments