static ProfileBotCommand ParseAdminCommand(string normalizedMessage) { switch (normalizedMessage) { case "validate all users": return(ValidateAllProfilesCommand.Create()); case "notify all users": return(NotifyAllProfilesCommand.Create()); } var commandParts = normalizedMessage.Split(' '); if (commandParts.Length == 2 && commandParts[1].StartsWith("<@")) { var verb = commandParts[0]; var subject = new SlackStringUser(commandParts[1].ToUpper()); switch (verb) { case "validate": return(new ValidateSingleProfileCommand(subject)); case "notify": return(new NotifySingleProfileCommand(subject)); } } return(UnknownCommand.Create()); }
static ProfileBotCommand ParseAdminCommand(string normalizedMessage) { switch (normalizedMessage) { case "validate all users": return(ValidateAllProfilesCommand.Create()); case "notify all users": return(NotifyAllProfilesCommand.Create()); case "version": return(ShowVersionNumberCommand.Create()); default: var commandParts = normalizedMessage.Split(' '); if (commandParts.Length == 2 && commandParts[1].StartsWith("<@") && commandParts[1][commandParts[1].Length - 1] == '>') { return(ParseVerbSubjectCommands(commandParts)); } if (normalizedMessage == "whitelist") { return(ShowWhitelistedUsersCommand.Create()); } return(UnknownCommand.Create()); } }
public void GetHashCode_TwoDifferent_NotEqual() { Assert.NotEqual(UnknownCommand.Create().GetHashCode(), ValidateAllProfilesCommand.Create().GetHashCode()); }
public void Equals_TwoDifferent_NotEqual() { // ReSharper disable once SuspiciousTypeConversion.Global Assert.False(UnknownCommand.Create().Equals(ValidateAllProfilesCommand.Create())); }