@@ -15,6 +15,7 @@ internal sealed class FakeModel : IModel
1515 private readonly ConcurrentDictionary < string , IBasicConsumer > consumers = new ConcurrentDictionary < string , IBasicConsumer > ( ) ;
1616 private readonly RabbitServer server ;
1717 private long lastDeliveryTag ;
18+ private bool confirmModeSelected ;
1819
1920 public FakeModel ( RabbitServer rabbitServer ) => server = rabbitServer ;
2021
@@ -173,12 +174,21 @@ public uint QueueDelete(string queue, bool ifUnused, bool ifEmpty)
173174 return instance != null ? 1u : 0u ;
174175 }
175176
176- public void ConfirmSelect ( ) => throw new NotImplementedException ( ) ;
177- public bool WaitForConfirms ( ) => throw new NotImplementedException ( ) ;
178- public bool WaitForConfirms ( TimeSpan timeout ) => throw new NotImplementedException ( ) ;
179- public bool WaitForConfirms ( TimeSpan timeout , out bool timedOut ) => throw new NotImplementedException ( ) ;
180- public void WaitForConfirmsOrDie ( ) => throw new NotImplementedException ( ) ;
181- public void WaitForConfirmsOrDie ( TimeSpan timeout ) => throw new NotImplementedException ( ) ;
177+ public void ConfirmSelect ( ) => confirmModeSelected = true ;
178+
179+ public void WaitForConfirmsOrDie ( ) => WaitForConfirmsOrDie ( TimeSpan . Zero ) ;
180+ public void WaitForConfirmsOrDie ( TimeSpan timeout ) => _ = WaitForConfirms ( timeout ) ;
181+
182+ public bool WaitForConfirms ( ) => WaitForConfirms ( TimeSpan . Zero ) ;
183+ public bool WaitForConfirms ( TimeSpan timeout ) => WaitForConfirms ( timeout , out _ ) ;
184+ public bool WaitForConfirms ( TimeSpan timeout , out bool timedOut )
185+ {
186+ if ( ! confirmModeSelected )
187+ throw new InvalidOperationException ( "Confirms not selected" ) ;
188+
189+ timedOut = false ;
190+ return true ;
191+ }
182192
183193 public string BasicConsume ( string queue , bool autoAck , IBasicConsumer consumer ) => BasicConsume ( queue , autoAck , Guid . NewGuid ( ) . ToString ( ) , true , false , null , consumer ) ;
184194 public string BasicConsume ( string queue , bool autoAck , string consumerTag , IBasicConsumer consumer ) => BasicConsume ( queue , autoAck , consumerTag , true , false , null , consumer ) ;
0 commit comments