コード例 #1
0
ファイル: TagCloudBuilderTests.cs プロジェクト: desolver/di
        public void Build_ReturnEmptyList_WhenWordsFreqEmpty()
        {
            var wordsFrequency = new List <Word>();

            var result = sut.Build(wordsFrequency);

            result.Should().Equal(new List <Tag>());
        }
コード例 #2
0
ファイル: TagCloudBuilderTests.cs プロジェクト: desolver/fp
        public void Build_ReturnEmptyList_WhenWordsFreqEmpty()
        {
            var wordsFrequency = new List <Word>();

            var result = sut.Build(wordsFrequency);

            result.IsSuccess.Should().BeTrue();
            result.GetValueOrThrow().Should().Equal(new List <Tag>());
        }
コード例 #3
0
        public void Perform()
        {
            var dialog = new OpenFileDialog
            {
                Title            = "Select file to build a tag cloud",
                CheckFileExists  = false,
                Multiselect      = false,
                DefaultExt       = "txt",
                InitialDirectory = @"C:\Users\Public\Documents",
                Filter           = "Текстовый документ |*.txt;*.doc;*.docx"
            };
            var res = dialog.ShowDialog();

            if (res != DialogResult.OK)
            {
                return;
            }

            SettingsForm.For(spiralParams).ShowDialog();

            textReader.ReadAllText(dialog.FileName)
            .Then(text => textHandler.GetHandledWords(text))
            .Then(handledWords => tagCloudBuilder.Build(handledWords))
            .Then(tagCloud => cloudVisualizer.PrintTagCloud(tagCloud))
            .OnFail(message => MessageBox.Show(message));
        }
コード例 #4
0
        public void Perform()
        {
            var result = SettingsForm.For(spiralParams).ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }

            var text         = textReader.ReadAllText(@"..\..\..\Examples\example.txt");
            var handledWords = textHandler.GetHandledWords(text);
            var tagCloud     = tagCloudBuilder.Build(handledWords);

            cloudVisualizer.PrintTagCloud(tagCloud);
        }
コード例 #5
0
        public void Perform()
        {
            var result = SettingsForm.For(spiralParams).ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }

            textReader.ReadAllText(@"..\..\..\Examples\example.txt")
            .Then(text => textHandler.GetHandledWords(text))
            .Then(handledWords => tagCloudBuilder.Build(handledWords))
            .Then(tagCloud => cloudVisualizer.PrintTagCloud(tagCloud))
            .OnFail(message => MessageBox.Show(message));
        }