Beispiel #1
0
        public void TestInputFileLine(string filename, InputFileMode mode)
        {
            FileReadLine fl = new FileReadLine()
            {
                Filename = filename
            };
            int caller = 0;

            if (mode == InputFileMode.LineByLine)
            {
                fl.Output.Select(s => new ContentSchema <string>()
                {
                    Content = s
                }).Subscribe(s =>
                {
                    Debug.WriteLine($"{++caller}-{s.Content.ToString()}");
                }, () =>
                {
                    Assert.AreEqual(caller, 349);
                });
            }
            if (mode == InputFileMode.Full)
            {
                fl.Output.Aggregate("", (a, b) => $"{a}\n{b}").Select(s => new ContentSchema <string>()
                {
                    Content = s
                }).Subscribe(s =>
                {
                    Debug.WriteLine($"{++caller}-{s.Content.ToString()}");
                }, () =>
                {
                    Assert.AreEqual(caller, 1);
                });
            }
        }
Beispiel #2
0
        protected override Task InternalStart(CancellationToken token)
        {
            FileReadLine fl = new FileReadLine()
            {
                Filename = Filename
            };

            if (Mode == InputFileMode.LineByLine)
            {
                fl.Output.Select(s => new ContentSchema <string>()
                {
                    Content = s
                }).Subscribe(OutputHandler, token);
            }
            else
            {
                fl.Output.Aggregate("", (a, b) => $"{a}\n{b}").Select(s => new ContentSchema <string>()
                {
                    Content = s
                }).Subscribe(OutputHandler, token);
            }


            return(Task.CompletedTask);
        }