public void WhenSerializableTypeThenBytesAreSet() { SerializableTestClass testClass = new SerializableTestClass { Name = "serializable-test-xxx" }; byte[] expected = testClass.ToByteArray(); _distributedCache.Set <SerializableTestClass>("serializable-test", testClass); _mockDistributedCache.Verify( dc => dc.Set( "serializable-test", It.Is <byte[]>(actual => VerifyBytes(expected, actual)), It.IsAny <DistributedCacheEntryOptions>())); }
public async Task WhenSerializableTypeThenBytesAreSetAsync() { SerializableTestClass testClass = new SerializableTestClass { Name = "serializable-test-xxx" }; byte[] expected = testClass.ToByteArray(); await _distributedCache.SetAsync <SerializableTestClass>("serializable-test", testClass); _mockDistributedCache.Verify( dc => dc.SetAsync( "serializable-test", It.Is <byte[]>(actual => VerifyBytes(expected, actual)), It.IsAny <DistributedCacheEntryOptions>(), It.IsAny <CancellationToken>())); }