The testing framework being used is NUnit, the Test Fixture and the related
interfaces are below

    [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; }
    }


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


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

>  can you post the entire test
>
>
> On 30/09/2011 10:40 AM, Matthew Brubaker wrote:
>
> unfortunately, that is the unit test that i have that's failing. I'm not
> sure how to isolate it down any further. The TypedFactoryFacility is the
> only facility in use and the two components are the only two things I am
> registering in the container.
>
> Matthew Brubaker
> [email protected]
> (785) 215-7061
>
>
> 2011/9/29 Krzysztof Koźmic <[email protected]>
>
>> Hi Matthew,
>>
>> Could you isolate this into a failing unit test?
>>
>> cheers,
>>  Krzysztof
>>
>>
>> On 30/09/2011 7:26 AM, Matthew Brubaker wrote:
>>
>>  I am currently using Castle.Widsor v3.0 Beta 1.
>>> The code I am having problems with at the moment is
>>>
>>> var _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())));
>>>
>>>         var _fwf = _container.Resolve<IFileWatcherFactory>();
>>>         var fw = _fwf.GetFileWatcher(".\\bob.txt", 20);
>>>
>>> The signature of IFileWatcherFactory.GetFileWatcher is
>>>
>>>         IFileWatcher GetFileWatcher(string filePath, int
>>> sleepIntervalInSeconds);
>>>
>>> this throws the following exception
>>>
>>>         Castle.MicroKernel.ComponentNotFoundException : No component
>>> for supporting the service IFileWatcher was found
>>>
>>> I have double checked all of the namespaces, usings, etc... and have
>>> been unable to make any progress. This worked correctly as written
>>> using Castle.Windsor v2.5.1 but stopped when I upgraded to v3.0.
>>>
>>> Any help would be greatly appreciated. If further information is
>>> needed, please let me know and I will do my best to provide it.
>>>
>>>
>> --
>> 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.
>>
>>
>  --
> 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.
>
>
>  --
> 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.
>

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