ICacheEntry null IMemoryCache test Xunit

Create the following extension method to set up a fake ICacheEntry while testing IMemoryCache methods in Xunit:

public static void SetUpCacheCreateEntry(this Mock<IMemoryCache> memoryCacheMockObject)
{
    var cachEntry = new Mock<ICacheEntry>();
    memoryCacheMockObject.Setup(x => x.CreateEntry(It.IsAny<string>())).Returns(cachEntry.Object);
}

Namespaces used:

using Microsoft.Extensions.Caching.Memory;
using Moq;

Usage of that method:

Mock<IMemoryCache> memoryCacheMockObject = new Mock<IMemoryCache>();
memoryCacheMockObject.SetUpCacheCreateEntry();