public async Task Host_WhenRequested_ShouldRedirectToSkill() { var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(2)); var testBot = new TestBotClient(new EnvironmentBotTestConfiguration()); await testBot.StartConversation(cancellationTokenSource.Token); await testBot.SendMessageAsync("Hi", cancellationTokenSource.Token); await testBot.AssertReplyAsync("Me no nothin", cancellationTokenSource.Token); await testBot.SendMessageAsync("skill", cancellationTokenSource.Token); await testBot.AssertReplyAsync("Echo: skill", cancellationTokenSource.Token); }
public async Task Host_WhenSkillEnds_HostReceivesEndOfConversation() { var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(2)); var testBot = new TestBotClient(new EnvironmentBotTestConfiguration()); await testBot.StartConversation(cancellationTokenSource.Token); await testBot.SendMessageAsync("Hi", cancellationTokenSource.Token); await testBot.AssertReplyAsync("Me no nothin", cancellationTokenSource.Token); await testBot.SendMessageAsync("skill", cancellationTokenSource.Token); await testBot.AssertReplyAsync("Echo: skill", cancellationTokenSource.Token); await testBot.SendMessageAsync("end", cancellationTokenSource.Token); await testBot.AssertReplyAsync("Received endOfConversation", cancellationTokenSource.Token); }
public async Task Skill_OAuthCard_SignInSuccessful() { // If the test takes more than one minute, declare failure. var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMinutes(2)); var testBot = new TestBotClient(new EnvironmentBotTestConfiguration()); await testBot.StartConversation(cancellationTokenSource.Token); await testBot.SendMessageAsync("Hello", cancellationTokenSource.Token); await testBot.AssertReplyAsync("Me no nothin", cancellationTokenSource.Token); await testBot.SendMessageAsync("skill", cancellationTokenSource.Token); await testBot.AssertReplyAsync("Echo: skill", cancellationTokenSource.Token); await testBot.SendMessageAsync("auth", cancellationTokenSource.Token); var messages = await testBot.ReadBotMessagesAsync(cancellationTokenSource.Token); var activities = messages.ToList(); Console.WriteLine("Enumerating activities:"); foreach (var a in activities) { Console.WriteLine($"Type={a.Type}; Text={a.Text}; Code={a.Code}; Attachments count={a.Attachments.Count}"); } var error = activities.FirstOrDefault( m => m.Type == ActivityTypes.EndOfConversation && m.Code == "SkillError"); if (error != null) { Assert.Fail(error.Text); } await testBot.SignInAndVerifyOAuthAsync(activities.FirstOrDefault(m => m.Attachments != null && m.Attachments.Any()), cancellationTokenSource.Token); }