public async Task Rename_Symbol_Should_TriggerUserConfirmationAsync(string sourceCode, string oldFilePath, string newFilePath) { var userNotificationServices = IUserNotificationServicesFactory.Create(); var roslynServices = IRoslynServicesFactory.Implement(new CSharpSyntaxFactsService()); var vsOnlineServices = IVsOnlineServicesFactory.Create(online: false); await RenameAsync(sourceCode, oldFilePath, newFilePath, userNotificationServices, roslynServices, vsOnlineServices, LanguageNames.CSharp); Mock.Get(userNotificationServices).Verify(h => h.Confirm(It.IsAny <string>()), Times.Once); Mock.Get(roslynServices).Verify(h => h.RenameSymbolAsync(It.IsAny <Solution>(), It.IsAny <ISymbol>(), It.IsAny <string>(), It.IsAny <CancellationToken>()), Times.Never); }
public async Task Rename_Symbol_Should_Not_HappenAsync(string sourceCode, string oldFilePath, string newFilePath) { var userNotificationServices = IUserNotificationServicesFactory.Create(); var roslynServices = IRoslynServicesFactory.Implement(new CSharpSyntaxFactsService()); var vsOnlineServices = IVsOnlineServicesFactory.Create(online: false); await RenameAsync(sourceCode, oldFilePath, newFilePath, userNotificationServices, roslynServices, vsOnlineServices, LanguageNames.CSharp).TimeoutAfter(TimeSpan.FromSeconds(1)); Mock.Get(userNotificationServices).Verify(h => h.Confirm(It.IsAny <string>()), Times.Never); Mock.Get(roslynServices).Verify(h => h.RenameSymbolAsync(It.IsAny <Solution>(), It.IsAny <ISymbol>(), It.IsAny <string>(), It.IsAny <CancellationToken>()), Times.Never); Mock.Get(roslynServices).Verify(h => h.ApplyChangesToSolution(It.IsAny <Workspace>(), It.IsAny <Solution>()), Times.Never); }
public async Task Rename_Symbol_Should_Not_HappenAsync(string oldFilePath, string newFilePath, string sourceCode) { var userNotificationServices = IUserNotificationServicesFactory.Create(); var roslynServices = IRoslynServicesFactory.Implement(new VisualBasicSyntaxFactsService()); var vsOnlineServices = IVsOnlineServicesFactory.Create(online: false); var settingsManagerService = CreateSettingsManagerService(true); await RenameAsync(sourceCode, oldFilePath, newFilePath, userNotificationServices, roslynServices, vsOnlineServices, LanguageNames.VisualBasic, settingsManagerService); Mock.Get(userNotificationServices).Verify(h => h.Confirm(It.IsAny <string>()), Times.Never); Mock.Get(roslynServices).Verify(h => h.RenameSymbolAsync(It.IsAny <Solution>(), It.IsAny <ISymbol>(), It.IsAny <string>(), It.IsAny <CancellationToken>()), Times.Never); Mock.Get(roslynServices).Verify(h => h.ApplyChangesToSolution(It.IsAny <Workspace>(), It.IsAny <Solution>()), Times.Never); }
public async Task Rename_Symbol_Should_ExitEarlyInVSOnlineAsync() { string sourceCode = "class Foo { }"; string oldFilePath = "Foo.cs"; string newFilePath = "Bar.cs"; var userNotificationServices = IUserNotificationServicesFactory.Create(); var roslynServices = IRoslynServicesFactory.Implement(new CSharpSyntaxFactsService()); var vsOnlineService = IVsOnlineServicesFactory.Create(online: true); await RenameAsync(sourceCode, oldFilePath, newFilePath, userNotificationServices, roslynServices, vsOnlineService, LanguageNames.CSharp); Mock.Get(userNotificationServices).Verify(h => h.Confirm(It.IsAny <string>()), Times.Never); Mock.Get(roslynServices).Verify(h => h.RenameSymbolAsync(It.IsAny <Solution>(), It.IsAny <ISymbol>(), It.IsAny <string>(), It.IsAny <CancellationToken>()), Times.Never); Mock.Get(roslynServices).Verify(h => h.ApplyChangesToSolution(It.IsAny <Workspace>(), It.IsAny <Solution>()), Times.Never); }
public async Task Rename_Symbol_Should_ExitEarlyInFileExtensionChange(string oldFilePath, string newFilePath) { string sourceCode = "class Foo { }"; var userNotificationServices = IUserNotificationServicesFactory.Create(); var roslynServices = IRoslynServicesFactory.Implement(new CSharpSyntaxFactsService()); var vsOnlineService = IVsOnlineServicesFactory.Create(online: false); var settingsManagerService = CreateSettingsManagerService(true); await RenameAsync(sourceCode, oldFilePath, newFilePath, userNotificationServices, roslynServices, vsOnlineService, LanguageNames.CSharp, settingsManagerService); bool disablePromptMessage; Mock.Get(userNotificationServices).Verify(h => h.Confirm(It.IsAny <string>(), out disablePromptMessage), Times.Never); Mock.Get(roslynServices).Verify(h => h.RenameSymbolAsync(It.IsAny <Solution>(), It.IsAny <ISymbol>(), It.IsAny <string>(), It.IsAny <CancellationToken>()), Times.Never); Mock.Get(roslynServices).Verify(h => h.ApplyChangesToSolution(It.IsAny <Workspace>(), It.IsAny <Solution>()), Times.Never); }