public void can_find_interface_implementation_when_method_is_virtual()
        {
            var method     = assembly.GetMethodDefinition <VirtualWithInterface>("A");
            var references = SynonymFinder.FindSynonymsFor(method);

            Assert.IsTrue(references.OnlyHasMember <IA>("A"));
        }
        public void can_find_base_interface_inheritance_synonyms()
        {
            var method     = assembly.GetMethodDefinition <DualImplementor>("A");
            var references = SynonymFinder.FindSynonymsFor(method);

            Assert.IsTrue(references.OnlyHasMember <IBase>("A"));
        }
        public void when_no_synonyms_none_are_found()
        {
            var method     = assembly.GetMethodDefinition <SimpleBase>("Test");
            var references = SynonymFinder.FindSynonymsFor(method);

            Assert.IsTrue(references.Count == 0);
        }
        public void can_find_explicit_interface_implementation()
        {
            var method     = assembly.GetMethodDefinition <ExplicitImplementor>("AutoTest.Minimizer.Tests.IA.A");
            var references = SynonymFinder.FindSynonymsFor(method);

            Assert.IsTrue(references.OnlyHasMember <IA>("A"));
        }
        public void can_find_simple_interface_implementation()
        {
            var method     = assembly.GetMethodDefinition <Implementor>("A");
            var references = SynonymFinder.FindSynonymsFor(method);

            Assert.IsTrue(references.OnlyHasMember <IA>("A"));
        }
        public void shadowed_virtual_base_class_method_is_not_found()
        {
            var method     = assembly.GetMethodDefinition <SimpleDerived>("VirtualShadow");
            var references = SynonymFinder.FindSynonymsFor(method);

            Assert.IsTrue(references.Count == 0);
        }
        public void simple_base_class_is_added()
        {
            var method     = assembly.GetMethodDefinition <SimpleDerived>("Test");
            var references = SynonymFinder.FindSynonymsFor(method);

            Assert.IsTrue(references.OnlyHasMember <SimpleBase>("Test"));
        }
        public void can_find_interface_implementation_on_base()
        {
            var method     = assembly.GetMethodDefinition <DerivedNoReimplementation>("A");
            var references = SynonymFinder.FindSynonymsFor(method);

            Assert.IsTrue(references.Count == 2);
            Assert.IsTrue(references.HasMember <IA>("A"));
            Assert.IsTrue(references.HasMember <BaseWithInterface>("A"));
        }
        public void simpleTest()
        {
            var mock = new MockIWoerterbuch("aaa").SetDefaultSource("T3ST", "der t3st", "le t3st", "il t3st", "the t3st")
                       .AddSynonymGroup("aaa", "bbb", "ccc").SetupAndReturn();


            var finder = new SynonymFinder(mock.Object, 15);
            var result = finder.GetSynonyme("aaa", "de");

            result.Should().HaveCount(1);
            result.First().Length.Should().Be(3);
            result.First().Index.Should().Be(0);
            result.First().Treffer.Should().Be("aaa");
        }
Esempio n. 10
0
        public PublicController(IEntityProvider entityProvider, IModelData modelData)
        {
            this.entityProvider = entityProvider;
            this.modelData      = modelData;

            var woerterbuch   = new FileWoerterbuch(new PhysicalFileSystem(), Path.Combine(DirectoryHelper.Instance.ConfigDirectory, "Synonyme"));
            var settingAsText = ServiceHelper.Settings["synonymMaxInputWords"];
            int maxInputWords;

            if (!string.IsNullOrEmpty(settingAsText))
            {
                maxInputWords = Convert.ToInt32(settingAsText);
            }
            else
            {
                maxInputWords = 15;
            }

            synonymFinder = new SynonymFinder(woerterbuch, maxInputWords);
        }