Ejemplo n.º 1
0
        public void A_file_is_created()
        {
            _baseDirectory = AppDomain.CurrentDomain.BaseDirectory;

            _filename = "test.dat";
            _path     = Path.Combine(_baseDirectory, _filename);

            System.IO.File.Delete(_path);

            _listener = new Future <FileCreated>();

            _channel  = new ChannelAdapter();
            _producer = new FileSystemEventProducer(_baseDirectory, _channel);

            using (var subscription = _channel.Connect(x => x.AddConsumerOf <FileCreated>().UsingConsumer(m => _listener.Complete(m))))
            {
                System.IO.File.Create(_path);

                _listener.WaitUntilCompleted(10.Seconds());
            }

            _producer.Dispose();
        }