private bool AddMenuItemForBlueprintRegistryItem(BlueprintRegistryItem registryItem) { MenuItem menuItem = new MenuItem() { Header = $"_{registryItem.Name}" }; menuItem.Click += async(object sender, RoutedEventArgs e) => { DesktopService.OpenBlueprint(registryItem.Id); }; this.BlueprintList.Items.Add(menuItem); return(true); }
private IBlueprintStorage GetBlueprintStorage(string name) { IBlueprint blueprint = new Blueprint() { Name = name }; BlueprintRegistryItem registryItem = new BlueprintRegistryItem() { Id = blueprint.Id, Name = name }; registryItem.SetFilePath("./"); return(new BlueprintStorage() { Id = blueprint.Id, Blueprint = blueprint, BlueprintRegistryItem = registryItem }); }
public void VerifySetAndRetrieveBlueprintList() { IAppSettings appSettings = GetAppSettingWithMocks(out IFileSystem fileSystem); Assert.Empty(appSettings.BlueprintList); var registryItem = new BlueprintRegistryItem() { Id = Guid.NewGuid(), Key = "Shhh this is a secret!" }; appSettings.BlueprintList.Add(registryItem); // overwriting settings with new settings to rebuild blueprint list from storage so we can assure it loads correctly appSettings = new AppSettings(fileSystem, new CryptoService()); Assert.Single(appSettings.BlueprintList); Assert.Equal(registryItem.Id, appSettings.BlueprintList[0].Id); Assert.Equal(registryItem.Key, appSettings.BlueprintList[0].Key); // Assure stored values are encrypted Assert.True(fileSystem.TryGetRegistryValue("BlueprintList", out string savedList)); Assert.DoesNotContain("Shhh this is a secret", savedList); }