public void CanIgnoreModulesWithoutInvokator()
        {
            lock (TestOrderingLock.Lock)
            {
                var services = new ServiceCollection();
                var fakefs   = new InMemoryFileProvider();
                fakefs.AddFile("viewComponents/test.os", "Функция ДругаяНоНеОбработкаВызова() КонецФункции");
                services.AddSingleton <IFileProvider>(fakefs);

                var serviceProvider = services.BuildServiceProvider();

                var cp = new ScriptedViewComponentFeatureProvider();
                cp.Runtime         = MakeRuntime();
                cp.ScriptsProvider = serviceProvider.GetService <IFileProvider>();

                var feature = new ViewComponentFeature();
                cp.PopulateFeature(new ApplicationPart[0], feature);

                Assert.Equal(0, feature.ViewComponents.Count);
            }
        }
Example #2
0
        public void CanPopulateViewComponentFeature()
        {
            lock (TestOrderingLock.Lock)
            {
                var services = new ServiceCollection();
                var fakefs   = new InMemoryFileProvider();
                fakefs.AddFile("viewComponents/test.os", "Функция ОбработкаВызова() КонецФункции");
                services.AddSingleton <IFileProvider>(fakefs);

                var serviceProvider = services.BuildServiceProvider();

                var cp = new ScriptedViewComponentFeatureProvider();
                cp.Engine             = new ScriptingEngine();
                cp.Engine.Environment = new RuntimeEnvironment();
                cp.ScriptsProvider    = serviceProvider.GetService <IFileProvider>();

                var feature = new ViewComponentFeature();
                cp.PopulateFeature(new ApplicationPart[0], feature);

                Assert.Equal(1, feature.ViewComponents.Count);
                Assert.Equal("testViewComponent", feature.ViewComponents[0].Name);
            }
        }