the only interface implementation i have is the one for the IFileWatcher. it
is pretty long, is there a particular part of it you want?


    public class FileWatcherSelector : DefaultTypedFactoryComponentSelector
    {

        protected override string GetComponentName(MethodInfo method,
object[] arguments)
        {
            if (method.Name == "GetFileWatcher" && arguments.Length == 2)
            {
                var fileName = Convert.ToString(arguments[0]);
                var scrubbedName = fileName.Replace('\\', '_').Replace(':',
'_').Replace(' ', '_');

                return "watching.{0}".FormatWith(scrubbedName);
            }

            return base.GetComponentName(method, arguments);
        }
    }

Matthew Brubaker
[email protected]
(785) 215-7061


2011/9/29 Krzysztof Koźmic <[email protected]>

> 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<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 castle-project-users@**
> googlegroups.com <[email protected]>.
> To unsubscribe from this group, send email to castle-project-users+**
> [email protected]<castle-project-users%[email protected]>
> .
> For more options, visit this group at http://groups.google.com/**
> group/castle-project-users?hl=**en<http://groups.google.com/group/castle-project-users?hl=en>
> .
>
>

-- 
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