public async Task CreateChannel_Given_valid_input_Should_create_channel() { // Arrange var sut = new SlackFacade(_httpClient, _slackOptions, null); var channelName = ChannelName.Create(Guid.NewGuid().ToString()); // Act var createChannelResponse = await sut.CreateChannel(channelName.ToString()); // Assert Assert.True(createChannelResponse.Ok); Assert.Equal(channelName, createChannelResponse.Channel.Name); Assert.NotEmpty(createChannelResponse.Channel.Id.ToString()); //Clean up integration test resources. await sut.ArchiveChannel(createChannelResponse.Channel.Id); }
public async Task InviteToChannel_Given_valid_input_Should_invite_to_channel() { // Arrange var sut = new SlackFacade(_httpClient, _slackOptions, null, new MemoryCache(new MemoryCacheOptions())); var channelName = ChannelName.Create(Guid.NewGuid().ToString()); var userEmail = _configuration.SLACK_TESTING_USER_EMAIL; // Act var createChannelResponse = await sut.CreateChannel(channelName.ToString()); await sut.InviteToChannel(userEmail, createChannelResponse.Channel.Id.ToString()); // Assert Assert.True(createChannelResponse.Ok); //Clean up integration test resources. await sut.ArchiveChannel(createChannelResponse.Channel.Id); }
public async Task SendNotificationToChannel_Given_valid_input_Should_send_notfication_to_channel() { // Arrange var sut = new SlackFacade(_httpClient, _slackOptions, null, new MemoryCache(new MemoryCacheOptions())); var channelName = ChannelName.Create(Guid.NewGuid().ToString()); const string message = "Integration test message."; // Act var createChannelResponse = await sut.CreateChannel(channelName.ToString()); var sendNotificationToChannelResponse = await sut.SendNotificationToChannel(createChannelResponse.Channel.Id, message : message); // Assert Assert.True(sendNotificationToChannelResponse.Ok); Assert.NotEmpty(sendNotificationToChannelResponse.TimeStamp); //Clean up integration test resources. await sut.ArchiveChannel(createChannelResponse.Channel.Id); }