public void TestTryGetFails() { Assert.IsFalse(GitCommandCache.TryGet(null, out var output, out var error)); Assert.IsFalse(GitCommandCache.TryGet(String.Empty, out output, out error)); Assert.IsNull(output); Assert.IsNull(error); }
public void TestTryGetFails() { byte[] output = null; byte[] error = null; Assert.IsFalse(GitCommandCache.TryGet(null, out output, out error)); Assert.IsFalse(GitCommandCache.TryGet(String.Empty, out output, out error)); Assert.IsNull(output); Assert.IsNull(error); }
private void CommandCacheItems_SelectedIndexChanged(object sender, EventArgs e) { string command = (string)CommandCacheItems.SelectedItem; if (GitCommandCache.TryGet(command, out var cmdout, out var cmderr)) { commandCacheOutput.Text = command + "\n-------------------------------------\n\n"; Encoding encoding = GitModule.SystemEncoding; commandCacheOutput.Text += EncodingHelper.DecodeString(cmdout, cmderr, ref encoding).Replace("\0", "\\0"); }
public void TestTryGet() { byte[] originalOutput = new byte[] { 11, 12 }; byte[] originalError = new byte[] { 13, 14 }; GitCommandCache.Add("git command", originalOutput, originalError); Assert.IsTrue(GitCommandCache.TryGet("git command", out var cachedOutput, out var cachedError)); Assert.AreEqual(cachedOutput, originalOutput); Assert.AreEqual(cachedError, originalError); }
private void CommandCacheItems_SelectedIndexChanged(object sender, EventArgs e) { string command = CommandCacheItems.SelectedItem as string; string output; if (GitCommandCache.TryGet(command, out output)) { commandCacheOutput.Text = command + "\n-------------------------------------\n\n"; commandCacheOutput.Text += output.Replace("\0", "\\0"); } else { commandCacheOutput.Text = string.Empty; } }