コード例 #1
0
        public void Catcher_Test_Files()
        {
            var src1  = new StringSource("F1,F2,F3,F4,F5", "{},{},{},{},{}");
            var saver = new StringSaver();
            var fs    = new MemoryFileStorage();

            var catcher = new Catcher(src1, new MemoryHandledStorage(), saver, fs);

            catcher.Go();

            Assert.AreEqual("{}{}{}{}{}", saver.Json);

            catcher.Go();

            Assert.AreEqual("{}{}{}{}{}", saver.Json);
        }
コード例 #2
0
        public void Catcher_Queue_0()
        {
            var JSON_A = "{a:1}";
            var JSON_B = "{b:1}";

            var src   = new StringSource("F1", JSON_A);
            var saver = new StringSaver();
            var fs    = new MemoryFileStorage();

            var catcher = new Catcher(src, new MemoryHandledStorage(), saver, fs);

            catcher.Go();

            Assert.AreEqual(JSON_A, saver.Json);

            src.Append("F2", JSON_B);

            catcher.Go();

            Assert.AreEqual($"{JSON_A}{JSON_B}", saver.Json);
        }
コード例 #3
0
        public void Catcher_Error()
        {
            var ERRM = "ERRM";

            var src1  = new StringSource("F1", "{ }");
            var saver = new ErrorSaver(ERRM);
            var fs    = new MemoryFileStorage();
            var hs    = new MemoryHandledStorage();

            var catcher = new Catcher(src1, hs, saver, fs);

            catcher.Go();

            Assert.IsTrue(hs.ErrorTable.ContainsKey("F1"));
            Assert.AreEqual(ERRM, hs.ErrorTable["F1"]);
        }
コード例 #4
0
        public void Catcher_Report_1()
        {
            var src = new StringSource($"F1", "{\"ReportPath\":\"APATH.PDF\"}");

            src.AddFile("APATH.PDF", "12345");

            var hnd   = new MemoryHandledStorage();
            var saver = new StringSaver();
            var f     = new MemoryFileStorage();

            var catcher = new Catcher(src, hnd, saver, f);

            catcher.Go();

            Assert.AreEqual("12345", f.Dict["APATH.PDF"]);
        }
コード例 #5
0
        public void Catcher_Queue_Err()
        {
            var JSON_OK  = "{a:1}";
            var JSON_ERR = "ERRR";

            var src = new StringSource("F1", JSON_OK);

            src.Append("F2", JSON_ERR);

            var saver = new StringSaver();
            var fs    = new MemoryFileStorage();

            var catcher = new Catcher(src, new MemoryHandledStorage(), saver, fs);

            catcher.Go();

            Assert.AreEqual(0, catcher.GetNewFiles().Count);
        }
コード例 #6
0
        public void Catcher_Test_0()
        {
            var src = new Mock <ISourceDirectory>();

            src.Setup(a => a.GetFiles()).Returns(new List <string> {
                "F1", "F2", "F3", "F4", "F5"
            });
            src.Setup(a => a.GetFileText(It.IsAny <string>())).Returns("{}");

            var saver = new Mock <IPasportSaver>();
            var fs    = new MemoryFileStorage();

            var catcher = new Catcher(src.Object, new MemoryHandledStorage(), saver.Object, fs);


            catcher.Go();

            saver.Verify(a => a.Save(It.IsAny <ProcessDTO>()), Times.Exactly(5));
        }
コード例 #7
0
        public void Catcher_Report_2()
        {
            var APATH = "APATH";

            var src = new StringSource($"F1", "{\"ReportPath\":\"" + APATH + "\"}");

            src.AddFile(APATH, "12345");

            var hnd   = new MemoryHandledStorage();
            var saver = new StringSaver();
            var f     = new MemoryFileStorage();

            var catcher = new Catcher(src, hnd, saver, f);

            catcher.Go();



            Assert.IsFalse(f.Dict.Keys.Contains(APATH));
        }
コード例 #8
0
        public void Catcher_Report_3()
        {
            var APATH = "APATH.PDF";

            var src = new StringSource($"F1", "{\"ReportPath\":\"" + APATH + "\"}");

            src.AddFile(APATH, "FILE_CONTENT_HERE");

            var hnd   = new MemoryHandledStorage();
            var saver = new StringSaver();
            var f     = new MemoryFileStorage();

            var catcher = new Catcher(src, hnd, saver, f);

            catcher.Go();

            var url = APATH;

            Assert.IsNotNull(saver.DTO.ReportURL);
            Assert.AreEqual(url, saver.DTO.ReportURL);
        }