public void TestAdd() { byte[] output = new byte[] { 11, 12 }; byte[] error = new byte[] { 13, 14 }; string[] expectedCachedCommand = { "git command" }; GitCommandCache.Add("git command", output, error); Assert.IsTrue(expectedCachedCommand.SequenceEqual(GitCommandCache.CachedCommands())); }
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); }
public void TestClean() { byte[] output = { 11, 12 }; byte[] error = { 13, 14 }; string[] expectedCachedCommand = { "git command" }; GitCommandCache.Add("git command", output, error); Assert.IsTrue(expectedCachedCommand.SequenceEqual(GitCommandCache.CachedCommands())); GitCommandCache.CleanCache(); Assert.IsFalse(GitCommandCache.CachedCommands().Any()); }
public void TestAddCannotCache() { GitCommandCache.Add(null, null, null); Assert.IsFalse(GitCommandCache.CachedCommands().Any()); }