Can you paste the selector and interface impl. as well?

cheers,
Krzysztof

On 30/09/2011 11:38 AM, Matthew Brubaker wrote:

    [TestFixture()]
    public class FileWatchersAndContainers
    {

        private WindsorContainer _container;
        private IFileWatcherFactory _fwf;

        [SetUp()]
        public void Setup()
        {
            //NOTE: container had to create the instance to
            //NOTE: be aware that it should tear it down.
            _container = new WindsorContainer();

            _container.AddFacility<TypedFactoryFacility>();
_container.Register(Component.For<IFileWatcher>().ImplementedBy<FileWatcher>().LifestyleTransient()); _container.Register(Component.For<IFileWatcherFactory>().AsFactory(x => x.SelectedWith(new FileWatcherSelector())));
        }

        [Test()]
        public void SetUpAndTest()
        {
            _fwf = _container.Resolve<IFileWatcherFactory>();
            var fw = _fwf.GetFileWatcher(".\\bob.txt", 20);

            fw.StartWatching();
            Assert.IsTrue(fw.IsWatching);

            _container.Dispose();
            Assert.IsFalse(fw.IsWatching, "Should have been stopped");
        }
    }
}



    public interface IFileWatcherFactory : IDisposable
    {
//http://stw.castleproject.org/Windsor.Typed-Factory-Facility-interface-based-factories.ashx IFileWatcher GetFileWatcher(string filePath, int sleepIntervalInSeconds);
        void Destroy(IFileWatcher fw);
    }


    public interface IFileWatcher : IDisposable
    {
        string FilePath { get; }
        event FileWatcher.FileFoundEventHandler FileFound;
        void StartWatching();
        void StopWatching();
        bool IsWatching { get; }
    }

--
You received this message because you are subscribed to the Google Groups "Castle 
Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to