public void GivenAGitHubVersionResponseCached_WhenClearingTheCache_ThenTheCacheFile_ShouldBeRemoved() { var responseToCache = new GitHubVersionResponse() { Name = "test", ResponseDate = DateTime.Now, Tag = "tag", Url = "url", When = new DateTimeOffset(DateTime.Now) }; responseToCache.SaveCache(); Assert.True(System.IO.File.Exists(GitHubVersionResponse.CacheFileName)); GitHubVersionResponse.ClearCache(); Assert.False(System.IO.File.Exists(GitHubVersionResponse.CacheFileName)); }
public void GivenAGitHubVersionResponse_WhenCachingTheResponse_ThenACacheFile_ShouldBeSaved() { var responseToCache = new GitHubVersionResponse() { Name = "test", ResponseDate = DateTime.Now, Tag = "tag", Url = "url", When = new DateTimeOffset(DateTime.Now) }; responseToCache.SaveCache(); var cache = GitHubVersionResponse.TryReadFromCache(); var cacheIsEqual = (cache != null && cache.Name == responseToCache.Name && cache.ResponseDate == responseToCache.ResponseDate && cache.Tag == responseToCache.Tag && cache.Url == responseToCache.Url && cache.When == responseToCache.When); Assert.True(cacheIsEqual); GitHubVersionResponse.ClearCache(); }