public void NameAndCoordinatesNotFilled() { var command = new PlaylistRecommendationCommand(); command.Validate(); Assert.Equal(true, command.Invalid); }
public void HandleCommandInvalid() { var command = new PlaylistRecommendationCommand(); var handler = new PlaylistRecommendationHandler(); var result = handler.Handle(command); Assert.Equal(false, result.Success); }
public void NameFilledButCoordinatesNotFilled() { var command = new PlaylistRecommendationCommand() { CityName = "Goiania", }; command.Validate(); Assert.Equal(true, command.Valid); }
public void CoordinatesFilledNotWithDigit() { var command = new PlaylistRecommendationCommand() { CityLatitude = "XX", CityLongitude = "XX" }; command.Validate(); Assert.Equal(true, command.Invalid); }
public void NameNotFilledButCoordinatesFilled() { var command = new PlaylistRecommendationCommand() { CityLatitude = "50", CityLongitude = "50" }; command.Validate(); Assert.Equal(true, command.Valid); }
public void NameFilledButCoordinatesFilledNotCorrect() { var command = new PlaylistRecommendationCommand() { CityName = "Goiania", CityLatitude = "", CityLongitude = "" }; command.Validate(); Assert.Equal(true, command.Valid); }
public void HandleCommandValid() { var command = new PlaylistRecommendationCommand() { CityName = "Goiania" }; var handler = new PlaylistRecommendationHandler(); var result = handler.Handle(command); Assert.Equal(true, result.Success); }
public IActionResult RecommendByCityName(string name) { try { var command = new PlaylistRecommendationCommand() { CityName = name, }; var result = _handler.Handle(command); return(Ok(result)); } catch (Exception) { return(StatusCode(500, new CommandResult(false, "Ocorreu um erro ao processar sua requisição, por favor, tente mais tarde."))); } }
public IActionResult GetWithCoordinates(string longitude, string latitude) { try { var command = new PlaylistRecommendationCommand() { CityLongitude = longitude, CityLatitude = latitude, }; var result = _handler.Handle(command); return(Ok(result)); } catch (Exception) { return(StatusCode(500, new CommandResult(false, "Ocorreu um erro ao processar sua requisição, por favor, tente mais tarde."))); } }