public void Setup() { _mocker = AutoMock.GetLoose(); _memoryCache = new MemoryCache(new MemoryCacheOptions()); _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()); _sut = _mocker.Create <ParticipantsController>(new TypedParameter(typeof(IEventHandlerFactory), eventHandlerFactory), new TypedParameter(typeof(IConferenceCache), _conferenceCache)); _sut.ControllerContext = context; _eventComponentHelper.Cache.Set(_testConference.Id, _testConference); _eventComponentHelper.RegisterUsersForHubContext(_testConference.Participants); }
public void Setup() { _mocker = AutoMock.GetLoose(); var eventHandlerMock = _mocker.Mock <IEventHandler>(); _mocker.Mock <IEventHandlerFactory>().Setup(x => x.Get(It.IsAny <EventHubEventType>())).Returns(eventHandlerMock.Object); var claimsPrincipal = new ClaimsPrincipalBuilder().Build(); var eventComponentHelper = new EventComponentHelper(); _testConference = eventComponentHelper.BuildConferenceForTest(); _testConference.Participants[0].Username = ClaimsPrincipalBuilder.Username; var context = new ControllerContext { HttpContext = new DefaultHttpContext { User = claimsPrincipal } }; _mocker.Mock <IMapperFactory>().Setup(x => x.Get <Conference, IEnumerable <JudgeInHearingResponse>, IEnumerable <ParticipantContactDetailsResponseVho> >()).Returns(_mocker.Create <ParticipantStatusResponseForVhoMapper>()); _mocker.Mock <IMapperFactory>().Setup(x => x.Get <EventType, string>()).Returns(_mocker.Create <EventTypeReasonMapper>()); _mocker.Mock <IMapperFactory>().Setup(x => x.Get <ConferenceEventRequest, Conference, CallbackEvent>()).Returns(_mocker.Create <CallbackEventMapper>()); _mocker.Mock <IMapperFactory>().Setup(x => x.Get <IEnumerable <ParticipantSummaryResponse>, List <ParticipantForUserResponse> >()).Returns(_mocker.Create <ParticipantForUserResponseMapper>()); _sut = _mocker.Create <ParticipantsController>(); _sut.ControllerContext = context; }
public void Setup() { _mocker = AutoMock.GetLoose(); _mocker.Mock <IMapperFactory>().Setup(x => x.Get <UpdateParticipantDisplayNameRequest, UpdateParticipantRequest>()).Returns(_mocker.Create <UpdateParticipantRequestMapper>()); var eventHandlerMock = _mocker.Mock <IEventHandler>(); _mocker.Mock <IEventHandlerFactory>().Setup(x => x.Get(It.IsAny <EventHubEventType>())).Returns(eventHandlerMock.Object); var claimsPrincipal = new ClaimsPrincipalBuilder().Build(); var eventComponentHelper = new EventComponentHelper(); _testConference = eventComponentHelper.BuildConferenceForTest(); _testConference.Participants[0].Username = ClaimsPrincipalBuilder.Username; var context = new ControllerContext { HttpContext = new DefaultHttpContext { User = claimsPrincipal } }; _sut = _mocker.Create <ParticipantsController>(); _sut.ControllerContext = context; }
public void Setup() { _mocker = AutoMock.GetLoose(); _eventComponentHelper = new EventComponentHelper(); var judge = CreateParticipant("Judge", "Judge"); var individual = CreateParticipant("Individual", "Claimant"); var interpreter = CreateParticipant("Interpreter", "Claimant"); var representative = CreateParticipant("Representative", "Defendant"); individual.LinkedParticipants.Add(new LinkedParticipant { LinkedId = interpreter.Id, LinkType = LinkType.Interpreter }); interpreter.LinkedParticipants.Add(new LinkedParticipant { LinkedId = individual.Id, LinkType = LinkType.Interpreter }); _participants = new List <Participant> { judge, individual, representative, interpreter }; var claimsPrincipal = new ClaimsPrincipalBuilder().WithRole(AppRoles.VhOfficerRole).Build(); _sut = SetupControllerWithClaims(claimsPrincipal); }
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() { _eventComponentHelper = new EventComponentHelper(); _videoApiClientMock = new Mock <IVideoApiClient>(); _mockLogger = new Mock <ILogger <ParticipantsController> >(MockBehavior.Loose); _mockConferenceCache = new Mock <IConferenceCache>(); var judge = CreateParticipant("Judge", "Judge"); var individual = CreateParticipant("Individual", "Claimant"); var representative = CreateParticipant("Representative", "Defendant"); _participants = new List <Participant> { judge, individual, representative }; var claimsPrincipal = new ClaimsPrincipalBuilder().WithRole(AppRoles.VhOfficerRole).Build(); _controller = SetupControllerWithClaims(claimsPrincipal); }