Beispiel #1
0
        public WebexTeamsMessageHandlerTest()
        {
            _apiService    = Substitute.For <IWebexTeamsApiService>();
            _messageParser = Substitute.For <IWebexTeamsMessageParser>();
            var mapper = new MapperConfiguration(c =>
            {
                c.AddProfile <CommonMappers>();
                c.AddProfile <PersonMapper>();
            }).CreateMapper();

            _subject = new WebexTeamsMessageHandler(_apiService, _messageParser, new WebexTeamsMapper(mapper));
        }
        public static WebexTeamsChatHelper CreateWebexTeamsChatHelper(WebexTeamsSettings settings)
        {
            var httpClient = new HttpClient {
                BaseAddress = new Uri("https://api.ciscospark.com/v1")
            };
            var httpClientProxy = new HttpClientProxy(httpClient, new OptionsWrapper <WebexTeamsSettings>(settings));
            var apiService      = new WebexTeamsApiService(httpClientProxy);

            var mapper        = WebexTeamsMapperFactory.CreateMapper();
            var messageParser = new WebexTeamsMessageParser(mapper);

            var messageHandler = new WebexTeamsMessageHandler(apiService, messageParser, mapper);
            var personHandler  = new WebexTeamsPersonHandler(apiService, mapper);
            var roomHandler    = new WebexTeamsRoomHandler(apiService, mapper);

            var webhooks = new WebexTeamsWebhookHandler(apiService, new OptionsWrapper <WebexTeamsSettings>(settings),
                                                        mapper, messageParser);

            return(new WebexTeamsChatHelper(messageHandler, personHandler, roomHandler, webhooks));
        }