19 lines
587 B
C#
19 lines
587 B
C#
using Microsoft.Extensions.Caching.Memory;
|
|
|
|
using Moq;
|
|
|
|
namespace MesaFabApproval.API.Test;
|
|
|
|
public static class MockMemoryCacheService {
|
|
public static Mock<IMemoryCache> GetMemoryCache(object expectedValue) {
|
|
Mock<IMemoryCache> mockMemoryCache = new Mock<IMemoryCache>();
|
|
mockMemoryCache
|
|
.Setup(x => x.TryGetValue(It.IsAny<object>(), out expectedValue))
|
|
.Returns(true);
|
|
mockMemoryCache
|
|
.Setup(x => x.CreateEntry(It.IsAny<object>()))
|
|
.Returns(Mock.Of<ICacheEntry>());
|
|
return mockMemoryCache;
|
|
}
|
|
}
|