public void Unsubscribe_MessagingEntityNotFoundException_RemovedSubscription( [Frozen] Mock <IEventBusSubscriptionsManager> mockSubsManager, [Frozen] Mock <ServiceBusAdministrationClient> mockAdminClient, [Frozen] Mock <IServiceBusPersisterConnection> mockConnection, sb.EventBusServiceBus sut ) { //Arrange mockConnection.Setup(_ => _.AdminClient) .Throws <Exception>(); //Act sut.Unsubscribe <TestIntegrationEvent, TestIntegrationEventHandler>(); //Assert mockAdminClient.Verify( _ => _.DeleteSubscriptionAsync( It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>() ), Times.Never ); mockSubsManager.Verify( _ => _.RemoveSubscription <TestIntegrationEvent, TestIntegrationEventHandler>() ); }
public void Unsubscribe_Ok_RemovedSubscription( [Frozen] Mock <IEventBusSubscriptionsManager> mockSubsManager, [Frozen] Mock <ServiceBusAdministrationClient> mockAdminClient, [Frozen] Mock <IServiceBusPersisterConnection> mockConnection, sb.EventBusServiceBus sut ) { //Arrange mockConnection.Setup(_ => _.AdminClient) .Returns(mockAdminClient.Object); //Act sut.Unsubscribe <TestIntegrationEvent, TestIntegrationEventHandler>(); //Assert mockAdminClient.Verify(_ => _.DeleteSubscriptionAsync( It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>() )); mockSubsManager.Verify( _ => _.RemoveSubscription <TestIntegrationEvent, TestIntegrationEventHandler>() ); }