Example #1
0
        public async Task X()
        {
            // setup
            var builder = new DbContextOptionsBuilder <ShipbotDbContext>()
                          .UseInMemoryDatabase("SlackMessageTest");
            var options = builder.Options;

            var context = new ShipbotDbContext(
                options,
                new[] { new SlackIntegrationDbContextConfigurator() }
                );
            var repo = new EntityRepository <SlackMessage>(context, new UnitOfWork(_loggerFactory.CreateLogger <UnitOfWork>(), context));

            var log = _loggerFactory.CreateLogger <SlackClient>();
            var slackConfiguration = new OptionsWrapper <SlackConfiguration>(new SlackConfiguration()
            {
                Token   = "xoxb-720397510838-721891676752-0ZZsUFHop90k4lOGdHkmn1qx",
                Timeout = 0
            });
            var client = new SlackClient(
                log,
                repo,
                new SlackClientWrapper(slackConfiguration),
                new SlackApiClientWrapper(slackConfiguration)
                );

            // run
            var handle = await client.PostMessageAsync("slack-bots-and-more", new SlackMessageBuilder("hello world").Build());

            await client.UpdateMessageAsync(handle, new SlackMessageBuilder("goodbye!").Build());

            // verify
        }