public void IfAnyMethodsNotConfigured_ThrowsException()
        {
            var originalImpl = new DummySingleKeyInterfaceImpl();

            var cache = new MockLocalCache <int, int>();

            Action action = () => CachedInterfaceFactory.For <IDummySingleKeyInterface>(originalImpl)
                            .Configure <int, int>(x => x.GetAsync, c => c.WithTimeToLive(TimeSpan.FromSeconds(1)).WithLocalCache(cache))
                            .Configure <int, int>(x => x.GetAsyncCanx, c => c.WithTimeToLive(TimeSpan.FromSeconds(1)).WithLocalCache(cache))
                            .Configure <int, int>(x => x.GetSync, c => c.WithTimeToLive(TimeSpan.FromSeconds(1)).WithLocalCache(cache))
                            .Build();

            action.Should().Throw <Exception>().Where(ex => ex.Message.Contains(nameof(IDummySingleKeyInterface.GetSyncCanx)));
        }
        public void SingleKey_WorksForAllMethodTypes()
        {
            var originalImpl = new DummySingleKeyInterfaceImpl();

            var cache1 = new MockLocalCache <int, int>();
            var cache2 = new MockLocalCache <int, int>();
            var cache3 = new MockLocalCache <int, int>();
            var cache4 = new MockLocalCache <int, int>();
            var cache5 = new MockLocalCache <int, int>();
            var cache6 = new MockLocalCache <int, int>();

            var cachedInterface = CachedInterfaceFactory.For <IDummySingleKeyInterface>(originalImpl)
                                  .Configure <int, int>(x => x.GetAsync, c => c.WithTimeToLive(TimeSpan.FromSeconds(1)).WithLocalCache(cache1))
                                  .Configure <int, int>(x => x.GetAsyncCanx, c => c.WithTimeToLive(TimeSpan.FromSeconds(1)).WithLocalCache(cache2))
                                  .Configure <int, int>(x => x.GetSync, c => c.WithTimeToLive(TimeSpan.FromSeconds(1)).WithLocalCache(cache3))
                                  .Configure <int, int>(x => x.GetSyncCanx, c => c.WithTimeToLive(TimeSpan.FromSeconds(1)).WithLocalCache(cache4))
                                  .Configure <int, int>(x => x.GetValueTask, c => c.WithTimeToLive(TimeSpan.FromSeconds(1)).WithLocalCache(cache5))
                                  .Configure <int, int>(x => x.GetValueTaskCanx, c => c.WithTimeToLive(TimeSpan.FromSeconds(1)).WithLocalCache(cache6))
                                  .Build();

            cachedInterface.GetAsync(1).Result.Should().Be(1);
            cache1.TryGet(1, out _).Should().BeTrue();

            cachedInterface.GetAsyncCanx(2, CancellationToken.None).Result.Should().Be(2);
            cache2.TryGet(2, out _).Should().BeTrue();

            cachedInterface.GetSync(3).Should().Be(3);
            cache3.TryGet(3, out _).Should().BeTrue();

            cachedInterface.GetSyncCanx(4, CancellationToken.None).Should().Be(4);
            cache4.TryGet(4, out _).Should().BeTrue();

            cachedInterface.GetValueTask(5).Result.Should().Be(5);
            cache5.TryGet(5, out _).Should().BeTrue();

            cachedInterface.GetValueTaskCanx(6, CancellationToken.None).Result.Should().Be(6);
            cache6.TryGet(6, out _).Should().BeTrue();
        }