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);
        }
Esempio n. 2
0
        public void Setup()
        {
            _memoryCache          = new MemoryCache(new MemoryCacheOptions());
            _conferenceCache      = new ConferenceCache(_memoryCache);
            _eventComponentHelper = new EventComponentHelper();
            _videoApiClientMock   = new Mock <IVideoApiClient>();
            var claimsPrincipal = new ClaimsPrincipalBuilder().Build();

            _testConference = _eventComponentHelper.BuildConferenceForTest();
            _mockLogger     = new Mock <ILogger <ParticipantsController> >();

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

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

            _controller = new ParticipantsController(_videoApiClientMock.Object, eventHandlerFactory, _conferenceCache,
                                                     _mockLogger.Object)
            {
                ControllerContext = context
            };
            _eventComponentHelper.Cache.Set(_testConference.Id, _testConference);
            _eventComponentHelper.RegisterUsersForHubContext(_testConference.Participants);
        }
        public void Setup()
        {
            var helper = new EventComponentHelper();

            EventHandlersList   = helper.GetHandlers();
            EventHubContextMock = helper.EventHubContextMock;
            EventHubClientMock  = helper.EventHubClientMock;
            MemoryCache         = helper.Cache;
            ConferenceCache     = helper.ConferenceCache;
            LoggerMock          = helper.EventHandlerBaseMock;
            VideoApiClientMock  = helper.VideoApiClientMock;

            TestConference = new ConferenceCacheModelBuilder().WithLinkedParticipantsInRoom().Build();
            MemoryCache.Set(TestConference.Id, TestConference);

            helper.RegisterUsersForHubContext(TestConference.Participants);
        }