static ShapeFactoryBenchmark()
        {
            _templateContext = new TemplateContext();
            var defaultShapeTable = new TestShapeTable
            {
                Bindings    = new Dictionary <string, ShapeBinding>(),
                Descriptors = new Dictionary <string, ShapeDescriptor>()
            };
            var shapeFactory = new DefaultShapeFactory(
                events: Enumerable.Empty <IShapeFactoryEvents>(),
                shapeTableManager: new TestShapeTableManager(defaultShapeTable),
                themeManager: new MockThemeManager(new ExtensionInfo("path", new ManifestInfo(new ModuleAttribute()), (x, y) => Enumerable.Empty <IFeatureInfo>())));

            _templateContext.AmbientValues["DisplayHelper"] = new DisplayHelper(null, shapeFactory, null);
        }
예제 #2
0
        public ShapeFactoryTests()
        {
            IServiceCollection serviceCollection = new ServiceCollection();

            serviceCollection.AddScoped <ILoggerFactory, StubLoggerFactory>();
            serviceCollection.AddScoped <IThemeManager, ThemeManager>();
            serviceCollection.AddScoped <IShapeFactory, DefaultShapeFactory>();
            serviceCollection.AddScoped <IExtensionManager, StubExtensionManager>();
            serviceCollection.AddScoped <IShapeTableManager, TestShapeTableManager>();

            var defaultShapeTable = new TestShapeTable
            {
                Descriptors = new Dictionary <string, ShapeDescriptor>(StringComparer.OrdinalIgnoreCase),
                Bindings    = new Dictionary <string, ShapeBinding>(StringComparer.OrdinalIgnoreCase)
            };

            serviceCollection.AddSingleton(defaultShapeTable);

            _serviceProvider = serviceCollection.BuildServiceProvider();
        }
        public DefaultDisplayManagerTests()
        {
            _defaultShapeTable = new TestShapeTable
            {
                Descriptors = new Dictionary <string, ShapeDescriptor>(StringComparer.OrdinalIgnoreCase),
                Bindings    = new Dictionary <string, ShapeBinding>(StringComparer.OrdinalIgnoreCase)
            };

            IServiceCollection serviceCollection = new ServiceCollection();

            serviceCollection.AddScoped <IThemeManager, ThemeManager>();
            serviceCollection.AddScoped <IHtmlDisplay, DefaultHtmlDisplay>();
            serviceCollection.AddScoped <IShapeTableManager, TestShapeTableManager>();
            serviceCollection.AddScoped <IShapeDisplayEvents, TestDisplayEvents>();
            serviceCollection.AddScoped <IExtensionManager, StubExtensionManager>();
            serviceCollection.AddScoped <IStringLocalizer <DefaultHtmlDisplay>, NullStringLocalizer <DefaultHtmlDisplay> >();
            serviceCollection.AddLogging();

            serviceCollection.AddSingleton(_defaultShapeTable);

            _serviceProvider = serviceCollection.BuildServiceProvider();
        }