/// <summary> /// Creates a new shortcut from given shortcut /// </summary> /// <param name="shortcut">A shortcut to use</param> public static Shortcut CreateShortcut(IShortcut shortcut) { var newShortcut = new Shortcut { Type = shortcut.Type, Description = shortcut.Description, }; newShortcut.Parameters.AddRange(shortcut.Parameters); return newShortcut; }
public void WhenValidShortcutWrittenAndRead_ThenReadShortcutReturns() { var handler = new ShortcutFileHandler(this.PathTo(@"Runtime.IntegrationTests.Content\Shortcuts\NewShortcut.shortcut")); var shortcut = new Shortcut { Type = "custom", Description = "somedescription", }; shortcut.Parameters.Add("foo", "bar"); handler.WriteShortcut(shortcut); Assert.True(File.Exists(handler.FilePath)); var loadedShortcut = handler.ReadShortcut(); Assert.NotNull(loadedShortcut); Assert.Equal("custom", loadedShortcut.Type); Assert.Equal("somedescription", loadedShortcut.Description); Assert.Equal(1, loadedShortcut.Parameters.Count); Assert.Equal("foo", loadedShortcut.Parameters.First().Key); Assert.Equal("bar", loadedShortcut.Parameters.First().Value); }