public void CreateOptions_WithAbsoluteExpirationRelativeToNow_ReturnsExpectedOptions() { // Arrange var absoluteExpirationRelativeToNow = TimeSpan.FromMinutes(2); // Act var options = MemoryCachingAdapter.CreateOptions(null, null, absoluteExpirationRelativeToNow); // Assert Assert.NotNull(options); Assert.Null(options.SlidingExpiration); Assert.Null(options.AbsoluteExpiration); Assert.Equal(absoluteExpirationRelativeToNow, options.AbsoluteExpirationRelativeToNow); }
public void CreateOptions_WithAbsoluteExpiration_ReturnsExpectedOptions() { // Arrange var absoluteExpiration = new DateTimeOffset(2020, 1, 1, 0, 0, 0, TimeSpan.Zero) + TimeSpan.FromMinutes(2); // Act var options = MemoryCachingAdapter.CreateOptions(null, absoluteExpiration, null); // Assert Assert.NotNull(options); Assert.Null(options.SlidingExpiration); Assert.Equal(absoluteExpiration, options.AbsoluteExpiration); Assert.Null(options.AbsoluteExpirationRelativeToNow); }