public FibonacciNumbers(IFibonacciCache fibonacciCache)
        {
            if (fibonacciCache == null)
            {
                throw new ArgumentNullException(nameof(fibonacciCache));
            }

            this.cache = fibonacciCache;
        }
        public FibonacciSequence(int count, IFibonacciCache cache)
        {
            if (count <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(count), "Count should be greater than zero.");
            }

            _count = count;
            _cache = cache;
        }
示例#3
0
 public FibonacciSequence(IFibonacciFactory fibonacciFactory, IFibonacciCache fibonacciCache)
 {
     this.fibonacciFactory = fibonacciFactory ?? throw new ArgumentNullException(nameof(fibonacciFactory));
     this.fibonacciCache   = fibonacciCache ?? throw new ArgumentNullException(nameof(fibonacciCache));
 }
示例#4
0
 public FibonacciSolver(IFibonacciCache cache)
 {
     _cache = cache;
 }
 public void Cleanup()
 {
     cacheService = null;
 }
 public void Initialize()
 {
     cacheService     = new RuntimeCaching();
     fibonacciFactory = new FibonacciFactory();
 }
示例#7
0
 public FibonacciService(IFibonacciCache cache, bool isCacheEnabled)
 {
     _cache          = cache;
     _isCacheEnabled = isCacheEnabled;
 }
示例#8
0
 private static void FeedData(IFibonacciCache cache)
 {
     cache.Save(0, 1);
     cache.Save(1, 90);
     cache.Save(-10, 33);
 }