示例#1
0
文件: ConfigWindow.cs 项目: Jevvry/di
        public ConfigWindow(WordConfig wordsConfig, ImageConfig imageConfig,
                            TagsCloudCreator tagsCloudProcessor, IServiceFactory <ITextFilter> filtersFactory,
                            IServiceFactory <IWordConverter> convertersFactory, IServiceFactory <ITagsGenerator> tagsGeneratorFactory,
                            IServiceFactory <IRectanglesLayouter> layouterFactory)
        {
            InitializeComponent();

            this.wordsConfig          = wordsConfig;
            this.imageConfig          = imageConfig;
            this.tagsGeneratorFactory = tagsGeneratorFactory;
            this.layouterFactory      = layouterFactory;
            this.tagsCloudProcessor   = tagsCloudProcessor;
            this.filtersFactory       = filtersFactory;
            this.convertersFactory    = convertersFactory;

            colorDialog           = new ColorDialog();
            fontDialog            = new FontDialog();
            saveFileDialog        = new SaveFileDialog();
            saveFileDialog.Filter = "Изображение (*.png)||Изображение (*.jpg)||Изображение (*.bmp)|";
            openFileDialog        = new OpenFileDialog();
            openFileDialog.Filter = "Текстовые файлы (*.txt)|";

            widthNumeric  = new NumericUpDown();
            heightNumeric = new NumericUpDown();

            tableLayoutPanel          = new TableLayoutPanel();
            tableLayoutPanel.Dock     = DockStyle.Fill;
            tableLayoutPanel.AutoSize = true;
            Controls.Add(tableLayoutPanel);

            InitView();
        }
示例#2
0
        public Form1()
        {
            InitializeComponent();
            var scope = Configurator.GetContainer().BeginLifetimeScope();

            creator = scope.Resolve <TagsCloudCreator>();
        }
示例#3
0
        public void CreateTagsCLoud_FileForTest_ReturnsCorrectCloudTags()
        {
            var tagsCloudCreator = new TagsCloudCreator(
                new CircularCloudLayouter(new CloudLayouterSettings()),
                new WordHandler(new WordHandlerSettings()),
                new WordConverter(new TagsSettings())
                );

            var tags = tagsCloudCreator.CreateTagsCloud(new FileWordsReader().GetAllData("FileForTest.txt"));

            Approvals.VerifyAll(
                tags,
                tag =>
                $" Tag{{\"{tag.Word}\" {nameof(tag.Frequency)}={tag.Frequency} {nameof(tag.Frame)}={tag.Frame}}}{Environment.NewLine}"
                );
        }
示例#4
0
        public void SetUp()
        {
            var path = TestContext.CurrentContext.TestDirectory;

            textPath          = Path.Combine(path, "Resources", "text.txt");
            imagePath         = Path.Combine(path, "Resources", "test.png");
            expectedImagePath = Path.Combine(path, "Resources", "expected.png");

            tagsCloudCreator = container.GetService <TagsCloudCreator>();

            wordsConfig = container.GetService <WordConfig>();
            ConfigureWordsConfig(textPath);

            imageConfig = container.GetService <ImageConfig>();
            ConfigureImageConfig(imagePath);
        }