public static string Apply(string input, string command) { switch (command) { case nameof(DiacriticsCommand): return(DiacriticsCommand.DiacriticsLogic(input, ToggleMode.Apply)); case nameof(DoubleCommand): return(DoubleCommand.DoubleLogic(input, ToggleMode.Apply)); case nameof(InvertCaseCommand): return(InvertCaseCommand.InvertCaseLogic(input)); case nameof(PaddingCommand): return(PaddingCommand.PaddingLogic(input, ToggleMode.Apply)); case nameof(ReverseCommand): return(ReverseCommand.ReverseLogic(input)); case nameof(SurroundCommand): return(SurroundCommand.SurroundLogic(input, ToggleMode.Apply)); default: return(input); } }
public void CanAddAndRemoveToggleActionsInDifferentOrder() { var origin = "Original String"; var modifiedStep1 = SurroundCommand.SurroundLogic(origin, ToggleMode.Apply); var modifiedStep2 = DiacriticsCommand.DiacriticsLogic(modifiedStep1, ToggleMode.Apply); var modifiedStep3 = DoubleCommand.DoubleLogic(modifiedStep2, ToggleMode.Apply); var modifiedStep4 = ReverseCommand.ReverseLogic(modifiedStep3); var modifiedStep5 = PaddingCommand.PaddingLogic(modifiedStep4, ToggleMode.Apply); var modifiedStep6 = InvertCaseCommand.InvertCaseLogic(modifiedStep5); var modifiedStep7 = DiacriticsCommand.DiacriticsLogic(modifiedStep6, ToggleMode.Reverse); var modifiedStep8 = SurroundCommand.SurroundLogic(modifiedStep7, ToggleMode.Reverse); var modifiedStep9 = DoubleCommand.DoubleLogic(modifiedStep8, ToggleMode.Reverse); var modifiedStep10 = ReverseCommand.ReverseLogic(modifiedStep9); var modifiedStep11 = InvertCaseCommand.InvertCaseLogic(modifiedStep10); var finalResult = PaddingCommand.PaddingLogic(modifiedStep11, ToggleMode.Reverse); Assert.AreEqual(origin, finalResult); }
public void MixedCaseWithSpaces() { var actual = InvertCaseCommand.InvertCaseLogic("This Is A Test"); Assert.AreEqual("tHIS iS a tEST", actual); }
public void CascalCase() { var actual = InvertCaseCommand.InvertCaseLogic("camelCase"); Assert.AreEqual("CAMELcASE", actual); }
public void PascalCase() { var actual = InvertCaseCommand.InvertCaseLogic("PascalCase"); Assert.AreEqual("pASCALcASE", actual); }
public void AllLower() { var actual = InvertCaseCommand.InvertCaseLogic("abc"); Assert.AreEqual("ABC", actual); }