Esempio n. 1
0
    public async Task ShouldReturnFailedResultWithPayload_Because_UserDoesNotSetCity()
    {
        DefaultUser.SetCity(string.Empty);
        var command = new WeatherNowCommand(GetWeatherService());
        var message = GenerateMessageWithPayload(DefaultUser.Id, DefaultUser.Id, command.Trigger, string.Empty);

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

        result.Should().BeOfType <FailedResult>();
        result.Message.Should().NotBeNullOrEmpty();
    }
Esempio n. 2
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();
    }
Esempio n. 3
0
    public async Task ShouldReturnFailedResult_Because_UserCityAndParameterAreEmpty()
    {
        DefaultUser.SetCity(string.Empty);
        var command = new WeatherNowCommand(GetWeatherService());
        var message = GenerateMessage(DefaultUser.Id, DefaultUser.Id, command.Aliases[0]);

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

        result.Should().BeOfType <FailedResult>();
        result.Message.Should().NotBeNullOrEmpty();
    }
    public async Task ShouldReturnFailedResult_Because_UserCityIsEmpty()
    {
        DefaultUser.SetCity(string.Empty);
        var command = new WeatherDailyKeyboardCommand();
        var message = GenerateMessage(DefaultUser.Id, DefaultUser.Id, command.Aliases[0]);

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

        result.Should().BeOfType <FailedResult>();
        result.Message.Should().NotBeNullOrEmpty();
    }