コード例 #1
0
        public void GetMostUsedTag_passFeaturedQuestions_returnMostUsedTag()
        {
            var data = LoadDataFromCode();

            var analyzer = new QuestionsAnalyzer(data);

            var result = analyzer.GetMostUsedTag();

            Assert.AreEqual("swift", result);
        }
コード例 #2
0
        public void FindQuestionsByTag_allTagsQuestionsReturned()
        {
            var jsonString = File.ReadAllText("questions.json");
            var data = JsonConvert.DeserializeObject<Rootobject>(jsonString);

            var analyzer = new QuestionsAnalyzer(data);

            var result = analyzer.FindQuestionsByTag("c#");

            Assert.AreEqual("Why are COM event handlers always null?", result.Single());
        }
コード例 #3
0
ファイル: ExportDemo.cs プロジェクト: oz-code/OzCodeDemo
        public void Start()
        {
            var featuredQuestions = Client.GetFeaturedQuestions();

            Debugger.Break();

            var analyzer = new QuestionsAnalyzer(featuredQuestions);

            var mostUsedTag = analyzer.GetMostUsedTag();

            MessageBox.Show("The most used tag is: " + mostUsedTag);

            if (analyzer.HasQuestionsWithTag("c#"))
            {
                var questionList = analyzer.FindQuestionsByTag("c#");

                MessageBox.Show("Selected questions: " + string.Join("\n",questionList.ToArray() ));
            }
        }