public void GetParameterString( string command, string commandName, string expecterParameterString ) { var parameterString = SignupImporter.GetParameterString(command, commandName); parameterString.Should().Be(expecterParameterString); }
public async Task ImportSignups([Remainder] string missionContent = null) { if (_client.GetGuild(_config.AFGuild) .GetUser(Context.User.Id) .Roles.All(x => x.Id != _config.MissionMakerRole)) { await ReplyWithException <NotAuthorizedException>("Nie jesteś uprawniony do tworzenia misji."); } if (SignupsData.Missions.Any( x => (x.Editing == Mission.EditEnum.New || x.Editing == Mission.EditEnum.Started) && x.Owner == Context.User.Id)) { await ReplyWithException <MissionEditionInProgressException>( "Edytujesz bądź tworzysz już misję!"); } if (Context.Message.Attachments.Any(x => x.Filename.Contains(".txt"))) { using var client = new HttpClient(); var response = await client.GetAsync(Context.Message.Attachments.First().Url); missionContent = await response.Content.ReadAsStringAsync(); } if (missionContent is null) { await ReplyWithException <InvalidCommandParametersException>("Niepoprawne parametry komendy."); } var signupImporter = new SignupImporter(Context, _commands, _map, this); await signupImporter.ProcessMessage(missionContent); await ReplyAsync("Zdefiniuj reszte misji."); }
public void GetCommandName(string command, string expectedCommandName) { var commandName = SignupImporter.GetCommandName(command); commandName.Should().Be(expectedCommandName); }
public void ParseCommands(IEnumerable <string> lines, IEnumerable <string> expectedCommandsList) { var parsedCommands = (IEnumerable <string>)SignupImporter.ParseCommands(lines); parsedCommands.Should().BeEquivalentTo(expectedCommandsList); }
public void ReadLines(string message, string[] expectedLines) { var linesRead = SignupImporter.ReadLines(message); linesRead.Should().BeEquivalentTo(expectedLines); }
public void GetLineEndings(string message, string expectedLinebreak) { var lineEnding = SignupImporter.GetLineEnding(message); lineEnding.Should().Be(expectedLinebreak); }