From a8b047bf3fa5e01c89f2671dafd424ed887709e9 Mon Sep 17 00:00:00 2001 From: Lilith River Date: Thu, 10 Dec 2020 12:59:20 -0700 Subject: [PATCH] Add tests to ensure null contentTypes are supported --- ...bridCacheSqliteTests.cs => HybridCacheTests.cs} | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) rename tests/Imazen.HybridCache.Tests/{HybridCacheSqliteTests.cs => HybridCacheTests.cs} (77%) diff --git a/tests/Imazen.HybridCache.Tests/HybridCacheSqliteTests.cs b/tests/Imazen.HybridCache.Tests/HybridCacheTests.cs similarity index 77% rename from tests/Imazen.HybridCache.Tests/HybridCacheSqliteTests.cs rename to tests/Imazen.HybridCache.Tests/HybridCacheTests.cs index 71ab1c9d..ac5ff3d5 100644 --- a/tests/Imazen.HybridCache.Tests/HybridCacheSqliteTests.cs +++ b/tests/Imazen.HybridCache.Tests/HybridCacheTests.cs @@ -38,7 +38,6 @@ Task>> DataProvider(CancellationToken token) } var result = await cache.GetOrCreateBytes(key, DataProvider, cancellationToken, true); - Assert.Equal("WriteSucceeded", result.Status); var result2 = await cache.GetOrCreateBytes(key, DataProvider, cancellationToken, true); @@ -53,7 +52,18 @@ Task>> DataProvider(CancellationToken token) Assert.Equal(contentType, result3.ContentType); Assert.NotNull(result3.Data); - + var key2 = new byte[] {2, 1, 2, 3}; + Task>> DataProvider2(CancellationToken token) + { + return Task.FromResult(new Tuple>(null, new ArraySegment(new byte[4000]))); + } + var result4 = await cache.GetOrCreateBytes(key2, DataProvider2, cancellationToken, true); + Assert.Equal("WriteSucceeded", result4.Status); + + var result5 = await cache.GetOrCreateBytes(key2, DataProvider, cancellationToken, true); + Assert.Equal("DiskHit", result5.Status); + Assert.Null(result5.ContentType); + Assert.NotNull(result5.Data); } finally {