Skip to content

Commit

Permalink
Add tests to ensure null contentTypes are supported
Browse files Browse the repository at this point in the history
  • Loading branch information
lilith committed Dec 10, 2020
1 parent 51d8d20 commit a8b047b
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ Task<Tuple<string, ArraySegment<byte>>> 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);
Expand All @@ -53,7 +52,18 @@ Task<Tuple<string, ArraySegment<byte>>> DataProvider(CancellationToken token)
Assert.Equal(contentType, result3.ContentType);
Assert.NotNull(result3.Data);


var key2 = new byte[] {2, 1, 2, 3};
Task<Tuple<string, ArraySegment<byte>>> DataProvider2(CancellationToken token)
{
return Task.FromResult(new Tuple<string, ArraySegment<byte>>(null, new ArraySegment<byte>(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
{
Expand Down

0 comments on commit a8b047b

Please sign in to comment.