Used for building mocked IMemoryCache entry.
Inheritance: IMemoryCacheEntryKeyBuilder, IAndMemoryCacheEntryBuilder
        /// <inheritdoc />
        public IAndMemoryCacheBuilder WithEntry(Action<IMemoryCacheEntryTestBuilder> memoryCacheEntryBuilder)
        {
            var newMemoryCacheEntryBuilder = new MemoryCacheEntryBuilder();
            memoryCacheEntryBuilder(newMemoryCacheEntryBuilder);
            var memoryCacheEntry = newMemoryCacheEntryBuilder.GetMockedMemoryCacheEntry();

            return this.WithEntry(memoryCacheEntry.Key, memoryCacheEntry.Value, new MemoryCacheEntryOptions
            {
                AbsoluteExpiration = memoryCacheEntry.AbsoluteExpiration,
                AbsoluteExpirationRelativeToNow = memoryCacheEntry.AbsoluteExpirationRelativeToNow,
                Priority = memoryCacheEntry.Priority,
                SlidingExpiration = memoryCacheEntry.SlidingExpiration
            });
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public IAndMemoryCacheBuilder WithEntry(Action <IMemoryCacheEntryKeyBuilder> memoryCacheEntryBuilder)
        {
            var newMemoryCacheEntryBuilder = new MemoryCacheEntryBuilder();

            memoryCacheEntryBuilder(newMemoryCacheEntryBuilder);
            var memoryCacheEntry = newMemoryCacheEntryBuilder.GetMemoryCacheEntryMock();

            return(this.WithEntry(memoryCacheEntry.Key, memoryCacheEntry.Value, new MemoryCacheEntryOptions
            {
                AbsoluteExpiration = memoryCacheEntry.AbsoluteExpiration,
                AbsoluteExpirationRelativeToNow = memoryCacheEntry.AbsoluteExpirationRelativeToNow,
                Priority = memoryCacheEntry.Priority,
                SlidingExpiration = memoryCacheEntry.SlidingExpiration
            }));
        }