public void AddResolver(IAnagramResolver resolver)
 {
     if (resolver == null)
     {
         throw new ArgumentNullException(nameof(resolver));
     }
     lock (_resolverGate)
     {
         _otherResolvers.Add(resolver);
     }
 }
        private IAnagramResolver FindBestResolver(AnagramOptions optins)
        {
            IAnagramResolver resolver = null;

            lock (_resolverGate)
            {
                var languageMatchSortedByType = _otherResolvers.FirstOrDefault(r => r.Language == optins.Language && r.Type != AnagramResolverType.File);
                resolver = languageMatchSortedByType;
            }
            return(resolver);
        }
 public void DisableResolver(IAnagramResolver resolver)
 {
     if (resolver == null)
     {
         throw new ArgumentNullException(nameof(resolver));
     }
     lock (_resolverGate)
     {
         _otherResolvers.Remove(resolver);
         _disabledResolver.Add(resolver);
     }
 }
Beispiel #4
0
        public void EnableResolverThrows_WhenNullResolver()
        {
            //Arrange
            IWordList[] sources = new IWordList[] { new TestWordList()
                                                    {
                                                        Language = "en"
                                                    } };
            Func <string, IWordGenerator> wordGeneratorFactory = (a) => { return(null); };
            var objectUnderTest = new AnagramResolverService(sources, wordGeneratorFactory);

            IAnagramResolver resolver = null;

            //Act
            //Assert
            objectUnderTest.EnableResolver(resolver);
        }
 public void RemoveResolver(IAnagramResolver resolver)
 {
     throw new NotImplementedException();
 }