예제 #1
0
        private static void TestTagProcessorLoop()
        {
            TestProcessor testProcessor = new TestProcessor(new Type[] { typeof(Frame) });
            TagProcessor  tagProcessor  = new TagProcessor(testProcessor);
            Tag           tag           = TagUtils.RawToTag(TestTags.demoTag2_3);

            tagProcessor.ProcessMessage(new ProcessorMessageInit());
            tagProcessor.Process(tag);

            UnitTest.Test(testProcessor.Objects.Where(
                              n => n.GetType() == typeof(Frame)).Count() == tag.Frames.Count());

            UnitTest.Test(testProcessor.Messages.Where(
                              n => n.GetType() == typeof(ProcessorMessageInit)).Count() == 1);
        }
예제 #2
0
        private static void TestIteration()
        {
            string path = VirtualDrive.VirtualFileName(@"TestDirectoryProcessor\TestIteration\");

            IEnumerable <string> files = from counter in Enumerable.Range(0, 2) select Path.Combine(path, "test" + counter + ".bin");

            files.ForEach(n => VirtualDrive.Store(n, new byte[] { }));

            TestProcessor      testProcessor = new TestProcessor(new Type[] { typeof(FileInfo) });
            DirectoryProcessor processor     = new DirectoryProcessor(testProcessor);

            processor.FileMask = "*.bin";

            processor.ProcessMessage(new ProcessorMessageInit());
            processor.Process(new DirectoryInfo(path));

            IEnumerable <string> dstFiles = from item in testProcessor.Objects select item.ToString();

            UnitTest.Test(files.SequenceEqual(dstFiles));

            VirtualDrive.DeleteDirectory(path, true);
        }