Пример #1
0
        public FeedbackBot(
            IFeedbackBotStateRepository stateRepository,
            ILoggerFactory loggerFactory,
            IEnumerable <IBotDialogCommand> commands,
            IEnumerable <ISurveyDefinition> surveys,
            IDialogFactory dialogFactory,
            IOptions <Features> featureToggles,
            IOptions <BotSettings> botSettings)
        {
            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            this.logger = loggerFactory.CreateLogger <FeedbackBot>();

            this.dialogFactory   = dialogFactory ?? throw new ArgumentNullException(nameof(dialogFactory));
            this.stateRepository = stateRepository ?? throw new ArgumentNullException(nameof(stateRepository));
            this.commands        = commands ?? throw new ArgumentNullException(nameof(commands));
            this.surveys         = surveys ?? throw new ArgumentNullException(nameof(surveys));
            this.featureToggles  = featureToggles.Value ?? throw new ArgumentNullException(nameof(featureToggles));
            this.botSettings     = botSettings.Value ?? throw new ArgumentNullException(nameof(botSettings));

            this.Dialogs = this.BuildDialogs();
        }
Пример #2
0
        public SurveyTests()
        {
            var userProfileAccessor = new Mock <IStatePropertyAccessor <UserProfile> >();
            var userProfile         = new UserProfile();

            userProfileAccessor.Setup(x => x.GetAsync(It.IsAny <ITurnContext>(), It.IsAny <Func <UserProfile> >(), It.IsAny <CancellationToken>())).ReturnsAsync(userProfile);
            var surveyState = new SurveyState();

            _features = new Features {
                CollateResponses = true, RealisticTypingDelay = false
            };
            var botSettings = new BotSettings();

            _feedbackServiceMock  = new Mock <IFeedbackService>();
            _feedbackBotStateMock = new Mock <IFeedbackBotStateRepository>();
            _feedbackBotStateMock.SetupGet(x => x.UserProfile).Returns(userProfileAccessor.Object);

            var dialogFactory = new DialogFactory(new List <IComponentBuilder <ComponentDialog> >
            {
                new FreeTextDialogComponentBuilder(_feedbackBotStateMock.Object, Options.Create(_features), Options.Create(botSettings)),
                new MultipleChoiceDialogComponentBuilder(_feedbackBotStateMock.Object, Options.Create(_features), Options.Create(botSettings), _feedbackServiceMock.Object),
                new SurveyStartDialogComponentBuilder(_feedbackBotStateMock.Object, Options.Create(_features), Options.Create(botSettings)),
                new SurveyEndDialogComponentBuilder(_feedbackBotStateMock.Object, Options.Create(_features), Options.Create(botSettings), _feedbackServiceMock.Object)
            });

            _dialog = dialogFactory.Create <SurveyDialog>(new InMemoryApprenticeFeedbackSurveyV6());
        }
Пример #3
0
 public SendToMobileTrigger(ISmsQueueProvider queue, IOptions <Notify> notifyConfig, BotConfiguration botConfiguration)
     : base("^bot--invite--mobile (44)(7)\\d{9}$", botConfiguration)
 {
     this.queue        = queue;
     this.notifyConfig = notifyConfig.Value;
 }