Ejemplo n.º 1
0
    public async Task SetAsync_ShouldSetValueWhenValueIsDefaultPrimitiveStruct()
    {
        var distributedCacheMock = new Mock <IDistributedCache>();

        distributedCacheMock.Setup(c =>
                                   c.SetAsync(It.IsAny <string>(), It.IsAny <byte[]>(), It.IsAny <DistributedCacheEntryOptions>(),
                                              It.IsAny <CancellationToken>()))
        .Verifiable();

        var cache = new DistributedFlow(distributedCacheMock.Object);
        await cache.SetAsync("Key", default(int), TimeSpan.MaxValue);

        distributedCacheMock
        .Verify(
            c => c.SetAsync(It.IsAny <string>(), It.IsAny <byte[]>(), It.IsAny <DistributedCacheEntryOptions>(),
                            It.IsAny <CancellationToken>()), Times.Once);
    }