public async Task OnboardingReceiverUnitTest(bool isFirst, string teamDivision) { var message = new Message { From = UnitTestBuilder.GetUserNode(), To = UnitTestBuilder.GetBotNode(), Content = PlainText.Parse("UnitTest_" + teamDivision) }; var userContext = new UserContext { FirstInteraction = isFirst }; bool success = false; try { success = await flowService.SendOnboardingFlowAsync(userContext, message, CancellationToken.None); userContext = await contextManager.GetUserContextAsync(message.From, CancellationToken.None); } catch (Exception ex) { ex.ShouldBeNull(); } finally { success.ShouldBeTrue(); if (!isFirst) { userContext.TeamDivision.ShouldBe(teamDivision); } } }
public void Config() { _sender = UnitTestBuilder.GetSender(); _quickReplyBuilder = new QuickReplyBuilder(); node = UnitTestBuilder.GetUserNode(); cancellationToken = UnitTestBuilder.GetCancellationToken(); }
public async Task SelectMainTeamReceiverUnitTest(string text, string teamTag) { var message = new Message { From = UnitTestBuilder.GetUserNode(), To = UnitTestBuilder.GetBotNode(), Content = PlainText.Parse(text + teamTag) }; var context = new UserContext { MainTeam = "" }; bool success = false; try { success = await flowService.SendSelectMainTeamFlowAsync(message, context, CancellationToken.None); context = await contextManager.GetUserContextAsync(message.From, CancellationToken.None); } catch (Exception ex) { ex.ShouldBeNull(); } finally { success.ShouldBeTrue(); context.MainTeam.ShouldBe(teamTag); } }
public void Config() { var sender = UnitTestBuilder.GetSender(); broadcastExtension = new BroadcastExtension(sender); node = UnitTestBuilder.GetUserNode(); cancellationToken = UnitTestBuilder.GetCancellationToken(); }
public void Config() { var client = UnitTestBuilder.GetClient(); filter = new OWLFilter(client); var sender = UnitTestBuilder.GetSender(); scheduler = new SchedulerExtension(sender); node = UnitTestBuilder.GetUserNode(); cancellationToken = UnitTestBuilder.GetCancellationToken(); }
public void Config() { var settings = UnitTestBuilder.GetSettings(); cancellationToken = UnitTestBuilder.GetCancellationToken(); _sender = UnitTestBuilder.GetSender(); _bucket = new BucketExtension(_sender); _contextManager = new ContextManager(_bucket); node = UnitTestBuilder.GetUserNode(); TypeUtil.RegisterDocument <UserContext>(); }
public async Task AgendaReceiverUnitTest() { var message = new Message { From = UnitTestBuilder.GetUserNode(), To = UnitTestBuilder.GetBotNode(), Content = PlainText.Parse("UnitTests") }; var context = new UserContext { AlertTeams = new List <string>() { { "DAL" }, { "BOS" }, { "HOU" }, { "NYE" }, { "SHD" }, { "VAL" }, { "GLA" }, { "LON" }, { "FLA" }, { "SEO" }, { "PHI" }, { "SFS" }, } }; bool success = false; try { success = await flowService.SendAgendaFlowAsync(context, message, CancellationToken.None); } catch (Exception ex) { ex.ShouldBeNull(); } finally { success.ShouldBeTrue(); } }
public async Task AlertReceiverUnitTest(string flow, string teamTag) { var message = new Message { From = UnitTestBuilder.GetUserNode(), To = UnitTestBuilder.GetBotNode(), Content = PlainText.Parse(flow + teamTag) }; var team = flow.Contains("Remove") ? teamTag : string.Empty; var userContext = new UserContext { AlertTeams = new List <string> { { team } } }; bool success = false; try { success = await flowService.SendAlertFlowAsync(userContext, message, CancellationToken.None); userContext = await contextManager.GetUserContextAsync(message.From, CancellationToken.None); } catch (Exception ex) { ex.ShouldBeNull(); } finally { success.ShouldBeTrue(); if (flow.Contains("Remove")) { userContext.AlertTeams.ShouldNotContain(teamTag); } else if (flow.Contains("Add")) { userContext.AlertTeams.ShouldContain(teamTag); } } }
public async Task NewsReceiverUnitTest() { var message = new Message { From = UnitTestBuilder.GetUserNode(), To = UnitTestBuilder.GetBotNode(), Content = PlainText.Parse("UnitTests") }; bool success = false; try { success = await flowService.SendNewsFlowAsync(message, CancellationToken.None); } catch (Exception ex) { ex.ShouldBeNull(); } finally { success.ShouldBeTrue(); } }