public async Task ShouldGetPersonById() { var person = await _wxTeamsApi.GetUserAsync(StaticTestingValues.JId); person.Should().NotBeNull(); person.Id.Should().Be(StaticTestingValues.JId); }
public async Task HandleCreatedMessage(WebhookData <Message> webhookData) { try { var person = await _wxTeamsApi.GetUserAsync(webhookData.Data.AuthorId); var room = await _wxTeamsApi.CreateRoomAsync("test"); await room.DeleteAsync(); // The Message Created event will also trigger off a message created by the bot // Unless you want to end up with an endless loop of messages, you have to make // sure you're not responding to yourself. // At the same time, it's probably a good idea to consider not letting your bot // respond to other bots at all. Only people. if (person.Type != PersonType.Bot) { var message = await _wxTeamsApi.GetMessageAsync(webhookData.Data.Id); var newMessage = MessageBuilder.New() .SendToRoom(message.RoomId) .WithMarkdown("**Hi!**") .Build(); await _wxTeamsApi.SendMessageAsync(newMessage); } } catch (Exception ex) { Console.WriteLine(ex); } }
public async Task ShouldUpdateFirstName() { var person = await _wxTeamsApi.GetUserAsync(StaticTestingValues.SpaceMonkeyId); person.FirstName.Should().Be("Nothing"); var firstNameUpdated = await person.UpdateFirstNameAsync("Johnny"); firstNameUpdated.FirstName.Should().Be("Johnny"); await person.UpdateFirstNameAsync("Nothing"); }