Beispiel #1
0
    public async Task ShouldReturnFailedResult_Because_UnknownValue()
    {
        var command = new MailingCommand(ApplicationContext);
        var message = GenerateMessageWithPayload(DefaultUser.Id, DefaultUser.Id, command.Trigger, "asd");

        var result = await command.Execute(message, DefaultUser);

        result.Should().BeOfType <FailedResult>();
        result.Message.Should().NotBeNullOrEmpty();
    }
Beispiel #2
0
    public async Task ShouldReturnFailedResult_Because_UserGroupIsZero()
    {
        DefaultUser.SetNarfuGroup(0);
        var command = new MailingCommand(ApplicationContext);
        var message = GenerateMessageWithPayload(DefaultUser.Id, DefaultUser.Id, command.Trigger, "schedule");

        var result = await command.Execute(message, DefaultUser);

        result.Should().BeOfType <FailedResult>("Группа пользователя не установлена");
        result.Message.Should().NotBeNullOrEmpty();
    }
Beispiel #3
0
    public async Task ShouldReturnFailedResult_Because_CityIsEmpty()
    {
        DefaultUser.SetCity(string.Empty);
        var command = new MailingCommand(ApplicationContext);
        var message = GenerateMessageWithPayload(DefaultUser.Id, DefaultUser.Id, command.Trigger, "weather");

        var result = await command.Execute(message, DefaultUser);

        result.Should().BeOfType <FailedResult>("Город пользователя не установлен");
        result.Message.Should().NotBeNullOrEmpty();
    }
Beispiel #4
0
    public async Task ShouldReturnSuccessfulResult_Because_ValueIsWeather()
    {
        var command = new MailingCommand(ApplicationContext);
        var message = GenerateMessageWithPayload(DefaultUser.Id, DefaultUser.Id, command.Trigger, "weather");

        var result = await command.Execute(message, DefaultUser);

        result.Should().BeOfType <SuccessfulResult>();
        result.Message.Should().NotBeNullOrEmpty();
        result.Keyboard.Should().NotBeNull();
        result.Keyboard.Buttons.Should().HaveCount(3);
    }