예제 #1
0
        public void ShouldDeleteDirectoryOnDispose()
        {
            var directory = Temporary.GetEmptyDirectory();

            directory.Value.Exists.Should().BeTrue();
            directory.Dispose();
            directory.Value.Exists.Should().BeFalse();
        }
        public async Task ShouldCache()
        {
            var sgx = new Mock <ISgxClient>(MockBehavior.Strict);

            sgx.SetupSequence(c => c.GetDay(It.IsAny <Day>())).ReturnsAsync("Hello!");

            using (var directory = Temporary.GetEmptyDirectory())
            {
                var cache = new HistoricalDataCache(sgx.Object, directory);
                Day day   = 1;
                var data  = await cache.GetDay(day);

                File.ReadAllText(cache.GetCacheFile(day).Absolute).Should().Be(data);
            }
        }