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); } }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> /// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param> /// <param name="progress">A provider for progress updates.</param> /// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns> protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // When initialized asynchronously, the current thread may be a background thread at this point. // Do any initialization that requires the UI thread after switching to the UI thread. await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); await SurroundCommand.InitializeAsync(this); await ReverseCommand.InitializeAsync(this); await PaddingCommand.InitializeAsync(this); await InvertCaseCommand.InitializeAsync(this); await DiacriticsCommand.InitializeAsync(this); await DoubleCommand.InitializeAsync(this); await UppercaseCommand.InitializeAsync(this); await XxxxxCommand.InitializeAsync(this); await L337Command.InitializeAsync(this); await AlternateCaseCommand.InitializeAsync(this); await SponsorRequestHelper.CheckIfNeedToShowAsync(); }
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); }