예제 #1
0
        public static void Add(FileLocation location)
        {
            var watchFolder  = _subtituteActor.AskAndWait <string>(new SubstituteAction(location.WatchFolder, _variables));
            var copyToFolder = _subtituteActor.AskAndWait <string>(new SubstituteAction(location.CopyToFolder, _variables));

            var watch = new FileSystemWatcher(watchFolder, location.Pattern);

            watch.Changed += (sender, args) => TellActor(args, copyToFolder);
            watch.Created += (sender, args) => TellActor(args, copyToFolder);
            watch.Renamed += (sender, args) => TellActor(args, copyToFolder);

            watch.EnableRaisingEvents   = true;
            watch.IncludeSubdirectories = location.WatchSubdirectories;

            _fileSystemWatchers.Add(location, watch);
        }
예제 #2
0
        public void Delivers_message_when_scheduled_time_reached()
        {
            _testReceiveActor.Tell(new ScheduleOnceMessage(TimeSpan.FromSeconds(1)));
            _testReceiveActor.AskAndWait <ActorIdentity>(new Identify(null), RemainingOrDefault); // verify that the ActorCell has started

            Scheduler.Advance(TimeSpan.FromSeconds(1));
            ExpectMsg <ScheduleOnceMessage>();
        }