Ejemplo n.º 1
0
        public void Basic_Import_Test(string ris_filepath)
        {
            string path = GetNormalizedPathToRISTestFile(ris_filepath);

            ASSERT.FileExists(path);

            string ris_text = GetTestFileContent(path);

            Result rv = new Result();

            rv.lines_set = SplitMultipleRISLines(ris_text);
            foreach (List <string> lines in rv.lines_set)
            {
                RISRecord record = MapRISLinesToDictionary(lines);
                rv.records.Add(record);
                rv.bibtex_items.Add(record.ToBibTeX());
            }

            // Serialize the result to JSON for easier comparison via ApprovalTests->BeyondCompare (that's what I use for *decades* now)
            string json_out = JsonConvert.SerializeObject(rv, Newtonsoft.Json.Formatting.Indented).Replace("\r\n", "\n");

            //ApprovalTests.Approvals.VerifyJson(json_out);   --> becomes the code below:
            ApprovalTests.Approvals.Verify(
                new QiqqaApprover(json_out, ris_filepath),
                ApprovalTests.Approvals.GetReporter()
                );
        }
        public static void Test()
        {
            string ris_text = File.ReadAllText(@"c:\TEMP\SAMPLEENDNOTE.TXT");
            List <List <string> > lines_set = SplitMultipleRISLines(ris_text);

            foreach (List <string> lines in lines_set)
            {
                RISRecord record = MapRISLinesToDictionary(lines);
                if (record.errors.Count > 0)
                {
                    Logging.Warn("Errors!");
                }

                BibTexItem bibtex = record.ToBibTeX();
                string     result = bibtex.ToBibTex();
            }
        }