public async Task EventToActivityAsyncShouldThrowArgumentNullException() { var slackApi = new Mock <SlackClientWrapper>(_testOptions); await Assert.ThrowsAsync <ArgumentNullException>(async() => { await SlackHelper.EventToActivityAsync(null, slackApi.Object, new CancellationToken()).ConfigureAwait(false); }); }
public async Task EventToActivityAsyncShouldReturnActivity() { var slackApi = new Mock <SlackClientWrapper>(_testOptions); var payload = File.ReadAllText(Directory.GetCurrentDirectory() + @"/Files/MessageBody.json"); var slackBody = JsonConvert.DeserializeObject <SlackRequestBody>(payload); var activity = await SlackHelper.EventToActivityAsync(slackBody.Event, slackApi.Object, new CancellationToken()).ConfigureAwait(false); Assert.Equal(slackBody.Event.Text, activity.Text); }
public async Task EventToActivityAsyncShouldReturnActivityWithTeamId() { var slackApi = new Mock <SlackClientWrapper>(_testOptions); var payload = File.ReadAllText(Directory.GetCurrentDirectory() + @"/Files/MessageBody.json"); var slackBody = JsonConvert.DeserializeObject <EventRequest>(payload); slackBody.Event.Channel = null; var activity = await SlackHelper.EventToActivityAsync(slackBody, slackApi.Object, new CancellationToken()).ConfigureAwait(false); Assert.Equal(slackBody.Event.AdditionalProperties["team"].ToString(), activity.Conversation.Id); }