コード例 #1
0
        public void Append()
        {
            var src = new StringSource("f1,f2", "c1,c2");

            src.Append("f3", "c3");

            Assert.AreEqual(3, src.GetFiles().Count);
        }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #4
0
        public void Catcher_Queue_Establish()
        {
            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 hnd   = new MemoryHandledStorage();

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

            catcher.Establish();

            Assert.AreEqual(0, fs.Dict.Count);
            Assert.IsTrue(string.IsNullOrEmpty(saver.Json));
            Assert.AreEqual(0, catcher.GetNewFiles().Count);
            Assert.AreEqual(0, hnd.ErrorTable.Count);
            Assert.AreEqual(2, hnd.Table.Count);
        }