RhinoMock - AssertWasCalled on same method with different parameter doesn't work

RhinoMock - AssertWasCalled on same method with different parameter doesn't work

I have this method:

I have this method:

        public void Handle(ShipmentConfirmedEvent message)
            var trackingOrderDto = new ShipmentConfirmedDto
                AccountId = message.AccountId,
                FirstName = message.CustomerFirstName,
                TransactionId = message.TransactionId,
                Language = message.LanguageCode,
                ExcludedCommunicationChannels = message.ExcludedCommunicationChannels,
                TrackingId = message.TrackingNumber

        Log.Info("Received notify of Shipment Confirmed request with id <{0}> for order {1}", message.GenerationId, message.TransactionId);
        if (!string.IsNullOrEmpty(_iosForcePushAccountId))
            Log.Info("Per device Ios, l'accountId {0} verrà forzato a {1} per configurazione", trackingOrderDto.AccountId, _iosForcePushAccountId);
            trackingOrderDto.AccountId = Convert.ToInt64(_iosForcePushAccountId);
        Log.Debug("Send push notification for IOS for AccountId <{0}>", trackingOrderDto.AccountId);
        var iosContent = _sender.Create(trackingOrderDto, "IOS");

        trackingOrderDto.AccountId = message.AccountId;

        if (!string.IsNullOrEmpty(_androidForcePushAccountId))
            Log.Info("Per device Android, l'accountId {0} verrà forzato a {1} per configurazione", trackingOrderDto.AccountId, _androidForcePushAccountId);
            trackingOrderDto.AccountId = Convert.ToInt64(_androidForcePushAccountId);
        Log.Debug("Send push notification for Android for AccountId <{0}>", trackingOrderDto.AccountId);
        var androidContent = _sender.Create(trackingOrderDto, "ANDROID");
    catch (ExcludedCommunicationChannelsException ex)
    catch (Exception ex)
        var msg = String.Format("Errore durante la gestione del messaggio relativo al PushNotification for username {0}", message.MailTo.First().Address);
        Log.Error(ex, msg);
        throw new Exception(ex.Message, ex);
    Log.Info("<{0}> Processed", message.GenerationId);

and I have this test:

    public void GivenAnOrderConfirmedEventWithForcedAccountId_WhenHandle_ThenCallSenderWithTheForcedAccountId()

    var service = new ShipmentConfirmedRequestEventConsumer(mockSender, "1111", "2222");

    NServiceBus.Testing.Test.Handler(svc => service)
            m =>
                m.AccountId = 407716;
                m.CustomerFirstName = "Marco";
                m.TransactionId = "T123456";
                m.LanguageCode = "IT";
                m.TrackingNumber = "642167921";
    mockSender.AssertWasCalled(x => x.Create(Arg<ShipmentConfirmedDto>.Matches(dto => dto.AccountId == 2222), Arg<string>.Is.Equal("ANDROID")));
    mockSender.AssertWasCalled(x => x.Create(Arg<ShipmentConfirmedDto>.Matches(dto => dto.AccountId == 1111), Arg<string>.Is.Equal("IOS")));

the second AssertWasCalled, the one related to IOS, throw exception because it seems to be overwritten, being within the method the first to be called.

I need to verify that the Create method is called twice within the method, with the parameters specified.

How can I modify the test in order to verify it?

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

C/C++ vs. Rust: A developer’s perspective

In this post, you'll see the difference between Rust and C/C++ in a developer’s perspective

some issues with a c# jumping code in unity

This the code I am having issues with, in fact when I press the space button, the player will just repeat the animation of jump and even the right arrow doesn't work anymore.