public void Setup()
        {
            _mocker = AutoMock.GetLoose();
            var memoryCache     = new MemoryCache(new MemoryCacheOptions());
            var conferenceCache = new ConferenceCache(memoryCache);

            _eventComponentHelper = new EventComponentHelper();
            var claimsPrincipal = new ClaimsPrincipalBuilder().Build();

            _testConference = _eventComponentHelper.BuildConferenceForTest();

            var context = new ControllerContext
            {
                HttpContext = new DefaultHttpContext
                {
                    User = claimsPrincipal
                }
            };

            var eventHandlerFactory = new EventHandlerFactory(_eventComponentHelper.GetHandlers());

            _controller = _mocker.Create <ParticipantsController>(new TypedParameter(typeof(IEventHandlerFactory), eventHandlerFactory), new TypedParameter(typeof(IConferenceCache), conferenceCache));
            _controller.ControllerContext = context;
            _eventComponentHelper.Cache.Set(_testConference.Id, _testConference);
            _eventComponentHelper.RegisterUsersForHubContext(_testConference.Participants);
        }
 private List <IEventHandler> GetHandlers(
     Mock <IHubContext <EventHub.Hub.EventHub, IEventHubClient> > eventHubContextMock,
     IMemoryCache memoryCache, Mock <ILogger <EventHandlerBase> > logger, Mock <IVideoApiClient> apiClientMock)
 {
     Cache                = memoryCache;
     ConferenceCache      = new ConferenceCache(memoryCache);
     EventHubContextMock  = eventHubContextMock;
     EventHubClientMock   = new Mock <IEventHubClient>();
     EventHandlerBaseMock = new Mock <ILogger <EventHandlerBase> >();
     VideoApiClientMock   = apiClientMock;
     return(new List <IEventHandler>
     {
         new CloseEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object, apiClientMock.Object),
         new DisconnectedEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object,
                                      apiClientMock.Object),
         new HelpEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object, apiClientMock.Object),
         new JoinedEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object,
                                apiClientMock.Object),
         new LeaveEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object, apiClientMock.Object),
         new StartEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object, apiClientMock.Object),
         new CountdownFinishedEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object, apiClientMock.Object),
         new PauseEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object, apiClientMock.Object),
         new SuspendEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object,
                                 apiClientMock.Object),
         new TransferEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object,
                                  apiClientMock.Object),
         new ParticipantJoiningEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object,
                                            apiClientMock.Object),
         new VhOfficerCallEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object,
                                       apiClientMock.Object),
         new EndpointJoinedEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object,
                                        apiClientMock.Object),
         new EndpointDisconnectedEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object,
                                              apiClientMock.Object),
         new EndpointTransferEventHandler(eventHubContextMock.Object, ConferenceCache, logger.Object,
                                          apiClientMock.Object),
     });
 }
 public void SetUp()
 {
     _memoryCache     = GetCache();
     _conferenceCache = new ConferenceCache(_memoryCache);
 }