示例#1
0
        public void TestFileInitialisation()
        {
            ConsumerFile consumer = new ConsumerFile("");

            Assert.ThrowsException <FileNotFoundException>(() => consumer.ConsumeInput(new Input("file", "test message")));

            consumer = new ConsumerFile(System.IO.Path.GetTempPath());
            consumer.ConsumeInput(new Input("File", "dummy test"));
            Assert.IsTrue(File.Exists(consumer.OutputFilePath), "Output file did not exist");
        }
示例#2
0
        public void TestCompleteConsumption()
        {
            using (StringWriter sw = new StringWriter())
            {
                Console.SetOut(sw);
                ConsumerFile consumer = new ConsumerFile("");
                Program.DEBUG_ENABLED = true; // needs to be enabled to show completed message.
                consumer.CompleteConsumption();

                Assert.IsTrue(sw.ToString().Contains("File Consumer - Consumption completed"), "did not find the expect consumption completed message");
            }
        }