public void TestCheckForUpdates() { SettingsService settingsService = new SettingsService(); this.mockSettingsService.SetupGet(x => x.UpdateCheckerPath).Returns(settingsService.UpdateCheckerPath); MockFile mockFile = new MockFile { FileExists = true }; this.mockFileSystem.SetupGet(x => x.File).Returns(mockFile); this.service.CheckForUpdates(); }
/// <summary> /// Checks for update. /// </summary> private static void CheckForUpdate() { TraceService.WriteLine("NinjaCoder.MvvmCross.UpdateChecker::CheckForUpdate"); try { VsIdeServiceClient client = new VsIdeServiceClient(); SettingsService settingsService = new SettingsService(); string[] keys = new string[1]; keys[0] = settingsService.GalleryId; Dictionary<string, string> requestContext = new Dictionary<string, string>() { { "LCID", "1033" }, {"SearchSource", "ExtensionManagerUpdate"}, }; string[] output = client.GetCurrentVersionsForVsixList(keys, requestContext); if (output.Length > 0) { string version = output[0]; TraceService.WriteLine("NinjaCoder.MvvmCross.UpdateChecker::CheckForUpdate version=" + version); settingsService.LatestVersionOnGallery = version; settingsService.LastCheckedForUpdateDateTime = DateTime.Now.ToString(CultureInfo.InvariantCulture); } } catch (Exception exception) { TraceService.WriteError("NinjaCoder.MvvmCross.UpdateChecker::CheckForUpdate Error=" + exception.Message); } }
public void TestGetUnitTestingSnippet() { CodeSnippet codeSnippet = new CodeSnippet { MockInitCode = "hello" }; this.mockTranslator.Setup(x => x.Translate(It.IsAny<string>())).Returns(codeSnippet); SettingsService settingsService = new SettingsService(); this.mockSettingsService.SetupGet(x => x.UnitTestingAssemblies) .Returns(settingsService.UnitTestingAssemblies); this.mockSettingsService.SetupGet(x => x.UnitTestingInitMethod) .Returns(settingsService.UnitTestingInitMethod); CodeSnippet codeSnippetReturn = this.service.GetUnitTestingSnippet("path"); Assert.IsTrue(codeSnippetReturn.MockInitCode == codeSnippet.MockInitCode); Assert.IsTrue(codeSnippetReturn.UsingStatements.Count == 2); Assert.IsTrue(codeSnippetReturn.TestInitMethod == settingsService.UnitTestingInitMethod); }
/// <summary> /// Adds the commands. /// </summary> internal void AddCommands() { TraceService.WriteLine("Connect::AddCommands"); /*CommandBar commandBar = this.AddCommandBar("Ninja Coder for MvvmCross and Xamarin Forms"); VSCommandInfo commandInfo = new VSCommandInfo { AddIn = this.AddInInstance, Name = "NinjaCoderforMvvmCrossAddProjects", ButtonText = "Add Projects", Tooltip = "Ninja Coder for MvvmCross and Xamarin Forms Add Projects", Action = this.BuildProjects, ParentCommand = commandBar, BitmapResourceId = 0, }; this.AddMenuItem(commandInfo);*/ CommandBar commandBar = this.AddCommandBar("Ninja Coder for MvvmCross"); VSCommandInfo commandInfo = new VSCommandInfo { AddIn = this.AddInInstance, Name = "NinjaCoderforMvvmCrossAddProjects", ButtonText = "Add Projects", Tooltip = "Ninja Coder for MvvmCross", Action = this.BuildProjects, ParentCommand = commandBar, BitmapResourceId = 0, }; this.AddMenuItem(commandInfo); commandInfo = new VSCommandInfo { AddIn = this.AddInInstance, Name = "NinjaCoderforMvvmCrossAddViewModel", ButtonText = "Add ViewModel and Views", Tooltip = "Ninja Coder for MvvmCross Add ViewModel and Views", Action = this.AddViewModelAndViews, ParentCommand = commandBar, BitmapResourceId = 0, }; this.AddMenuItem(commandInfo); commandInfo = new VSCommandInfo { AddIn = this.AddInInstance, Name = "NinjaCoderforMvvmCrossAddPlugins", ButtonText = "Add Plugins", Tooltip = "Ninja Coder for MvvmCross Add Plugins", Action = this.AddPlugins, ParentCommand = commandBar, BitmapResourceId = 0, }; this.AddMenuItem(commandInfo); commandInfo = new VSCommandInfo { AddIn = this.AddInInstance, Name = "NinjaCoderforMvvmCrossAddNugetPackages", ButtonText = "Add Nuget Packages", Tooltip = "Ninja Coder for MvvmCross Add Nuget Packages", Action = this.AddNugetPackages, ParentCommand = commandBar, BitmapResourceId = 0, }; this.AddMenuItem(commandInfo); commandInfo = new VSCommandInfo { AddIn = this.AddInInstance, Name = "NinjaCoderforMvvmCrossOptions", ButtonText = "Options", Tooltip = "Ninja Coder for MvvmCross and Xamarin Forms Options", Action = this.ShowOptions, ParentCommand = commandBar, BitmapResourceId = 0 }; this.AddMenuItem(commandInfo); SettingsService settingsService = new SettingsService(); if (settingsService.ShowViewLogFileOnVisualStudioMenu) { commandInfo = new VSCommandInfo { AddIn = this.AddInInstance, Name = "NinjaCoderforMvvmCrossViewLogFile", ButtonText = "View Log File", Tooltip = "Ninja Coder for MvvmCross View and Xamarin Forms Log File", Action = this.ViewLogFile, ParentCommand = commandBar, BitmapResourceId = 0 }; this.AddMenuItem(commandInfo); } if (settingsService.ShowClearLogFileOnVisualStudioMenu) { commandInfo = new VSCommandInfo { AddIn = this.AddInInstance, Name = "NinjaCoderforMvvmCrossClearLogFile", ButtonText = "Clear Log File", Tooltip = "Ninja Coder for MvvmCross and Xamarin Forms Clear Log File", Action = this.ClearLogFile, ParentCommand = commandBar, BitmapResourceId = 0 }; this.AddMenuItem(commandInfo); } commandInfo = new VSCommandInfo { AddIn = this.AddInInstance, Name = "NinjaCoderforMvvmCrossAbout", ButtonText = "About", Tooltip = "Ninja Coder for MvvmCross and Xamarin Forms About", Action = this.ShowAbout, ParentCommand = commandBar, BitmapResourceId = 0 }; this.AddMenuItem(commandInfo); TraceService.WriteLine("Connect::AddCommands Ended"); }