@@ -18,17 +18,15 @@ public sealed class PacketLogBuilderServiceTests
1818{
1919 [ Theory ]
2020 [ MemberData ( nameof ( PacketBuffersWithRepeats ) ) ]
21- public void Build_PacketLogs_ReturnsNullOnRepetitions ( IEnumerable < ( bool IsOutgoing , byte [ ] Buffer , bool IsNull ) > packets )
21+ public void WritePacketLog_IncrementsRepetitionsForRepeatedPackets ( IEnumerable < ( bool IsOutgoing , byte [ ] Buffer , int Repetitions ) > packets )
2222 {
2323 PacketLogHandlerService service = CreateService ( true ) ;
24- foreach ( ( bool IsOutgoing , byte [ ] Buffer , bool IsNull ) packet in packets )
24+ foreach ( ( bool IsOutgoing , byte [ ] Buffer , int Repetitions ) expected in packets )
2525 {
26- PacketLog ? pLog = service . WritePacketLog ( packet . Buffer , packet . IsOutgoing , IHFormat . EvaWire , string . Empty ) ;
27- if ( packet . IsNull )
28- {
29- Assert . Null ( pLog ) ;
30- }
31- else Assert . NotNull ( pLog ) ;
26+ PacketLog ? actual = service . WritePacketLog ( expected . Buffer , expected . IsOutgoing , IHFormat . EvaWire , string . Empty ) ;
27+
28+ Assert . NotNull ( actual ) ;
29+ Assert . Equal ( expected . Repetitions , actual . Repetitions ) ;
3230 }
3331 }
3432
@@ -69,16 +67,16 @@ private static PacketLogHandlerService CreateService(bool compactRepetitions)
6967 new FakeClientHandlerService ( ) ) ;
7068 }
7169
72- public static TheoryData < IEnumerable < ( bool IsOutgoing , byte [ ] Packet , bool IsNull ) > > PacketBuffersWithRepeats => new ( )
70+ public static TheoryData < IEnumerable < ( bool IsOutgoing , byte [ ] Packet , int Repetitions ) > > PacketBuffersWithRepeats => new ( )
7371 {
74- new ( bool , byte [ ] , bool ) [ ]
72+ new ( bool , byte [ ] , int ) [ ]
7573 {
76- ( true , [ 0 , 0 , 0 , 2 , 0 , 5 ] , false ) ,
77- ( true , [ 0 , 0 , 0 , 2 , 0 , 5 ] , true ) ,
78- ( true , [ 0 , 0 , 0 , 2 , 0 , 5 ] , true ) ,
79- ( true , [ 0 , 0 , 0 , 2 , 0 , 6 ] , false ) ,
80- ( false , [ 0 , 0 , 0 , 30 , 0 , 7 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 ] , false ) ,
81- ( false , [ 0 , 0 , 0 , 2 , 0 , 8 ] , false ) ,
74+ ( true , [ 0 , 0 , 0 , 2 , 0 , 5 ] , 1 ) ,
75+ ( true , [ 0 , 0 , 0 , 2 , 0 , 5 ] , 2 ) ,
76+ ( true , [ 0 , 0 , 0 , 2 , 0 , 5 ] , 3 ) ,
77+ ( true , [ 0 , 0 , 0 , 2 , 0 , 6 ] , 1 ) ,
78+ ( false , [ 0 , 0 , 0 , 30 , 0 , 7 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 , 99 ] , 1 ) ,
79+ ( false , [ 0 , 0 , 0 , 2 , 0 , 8 ] , 1 ) ,
8280 } ,
8381 } ;
8482
0 commit comments