private static async Task <bool> SeedData(IChatBotRepository botRepo)
        {
            if (await IsAlreadySeeded(botRepo))
            {
                return(false);
            }

            ChatBot[] testBots =
            {
                new ChatBot
                {
                    Name     = "tg-bot",
                    Platform = "telegram",
                    Url      = "https://localhsot:5001/tg-bot",
                    Token    = "foo:bar",
                },
                new ChatBot
                {
                    Name     = "zvOnSlack",
                    Platform = "slack",
                    Url      = "https://localhsot:5001/zvOnSlack",
                    Token    = "aT0k3nFoR:zvOnSlack",
                },
            };

            foreach (var bot in testBots)
            {
                await botRepo.AddAsync(bot);
            }

            return(true);
        }
        private static async Task <bool> IsAlreadySeeded(IChatBotRepository botRepo)
        {
            var bot = await botRepo.GetByNameAsync("tg-bot");

            bool botExists = bot != null;

            return(botExists);
        }
Beispiel #3
0
 public BasicAuthenticationHandler(
     IChatBotRepository botsRepo,
     IOptionsMonitor <AuthenticationSchemeOptions> options,
     ILoggerFactory logger,
     UrlEncoder encoder,
     ISystemClock clock
     )
     : base(options, logger, encoder, clock)
 {
     _botsRepo = botsRepo;
 }
Beispiel #4
0
 /// <inheritdoc />
 public RegistrationService(
     IUserRegistrationRepository regsRepo,
     IChatBotRepository botsRepo,
     IZevereClient zvClient,
     ILogger logger = default
     )
 {
     _regsRepo = regsRepo;
     _botsRepo = botsRepo;
     _zvClient = zvClient;
     _logger   = logger;
 }
 public MessageParserServices(IWeatherRepository weatherRepository,
                              IExchangeRateRepository exchangeRateRepository,
                              ITelegramRepository telegramRepository,
                              IChatBotRepository chatBotRepository,
                              IReviewRepository reviewRepository,
                              ICryptoRepository cryptoRepository)
 {
     _weatherRepository      = weatherRepository;
     _exchangeRateRepository = exchangeRateRepository;
     _telegramRepository     = telegramRepository;
     _chatBotRepository      = chatBotRepository;
     _reviewRepository       = reviewRepository;
     _cryptoRepository       = cryptoRepository;
 }
 public UserRegistrationFailureTests(DatabaseFixture fixture)
 {
     _botsRepo         = new ChatBotRepository(fixture.ChatBotsCollection);
     _registrationRepo = new UserRegistrationRepository(fixture.RegistrationsCollection);
     _zevereClient     = new ZevereClient(new Settings().ZevereApiEndpoint);
 }