Exemple #1
0
            public async Task Can_Hear_Things_With_Parameters()
            {
                // Given
                var fixture = InMemoryBotFixture.Hear("Hello (?<Name>[\\w]+)", async(ctx) => {
                    await ctx.SendAsync(ctx.Parameters["Name"].ToString());
                });

                // When
                var response = await fixture.SendAsync("Hello NuBot :waves:");

                // Then
                Assert.Equal("NuBot", response);
            }
Exemple #2
0
            public async Task Can_Hear_Case_Insensitive_Things()
            {
                // Given
                var fixture = InMemoryBotFixture.Hear("hElO", async(ctx) => {
                    await ctx.SendAsync("OK");
                });

                // When
                var response = await fixture.SendAsync("helo");

                // Then
                Assert.Equal("OK", response);
            }
Exemple #3
0
            public async Task Can_Hear_Things()
            {
                // Given
                var fixture = InMemoryBotFixture.Hear("ship it", async(ctx) => {
                    await ctx.SendAsync(":shipit:");
                });

                // When
                var response = await fixture.SendAsync("we should totally ship it!");

                // Then
                Assert.Equal(":shipit:", response);
            }