Пример #1
0
        /// <inheritdoc />
        public IAndMemoryCacheTestBuilder ContainingEntry(Action <IMemoryCacheEntryKeyTestBuilder> memoryCacheEntryTestBuilder)
        {
            var mockedMemoryCache = this.GetMemoryCacheMock();

            var newMemoryCacheEntryBuilder = new MemoryCacheEntryTestBuilder(this.TestContext);

            memoryCacheEntryTestBuilder(newMemoryCacheEntryBuilder);
            var expectedMemoryCacheEntry = newMemoryCacheEntryBuilder.GetMemoryCacheEntryMock();

            var key = expectedMemoryCacheEntry.Key;

            this.ContainingEntryWithKey(key);

            mockedMemoryCache.TryGetCacheEntry(key, out var actualMemoryCacheEntry);

            var validations = newMemoryCacheEntryBuilder.GetMemoryCacheEntryMockValidations();

            validations.ForEach(v => v(expectedMemoryCacheEntry, actualMemoryCacheEntry));

            return(this);
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MemoryCacheEntryDetailsTestBuilder{TValue}"/> class.
 /// </summary>
 /// <param name="memoryCacheEntryTestBuilder">Test builder of <see cref="MemoryCacheEntryTestBuilder"/> type.</param>
 public MemoryCacheEntryDetailsTestBuilder(MemoryCacheEntryTestBuilder memoryCacheEntryTestBuilder)
     : base(memoryCacheEntryTestBuilder.TestContext)
 {
     CommonValidator.CheckForNullReference(memoryCacheEntryTestBuilder, nameof(memoryCacheEntryTestBuilder));
     this.memoryCacheEntryTestBuilder = memoryCacheEntryTestBuilder;
 }