Re: xeva IoC specs

1 view
Skip to first unread message

David Laribee

unread,
Jan 10, 2008, 3:35:49 PM1/10/08
to xe...@googlegroups.com
Awesome Bil. We will add them in next time we touch the code!

On Jan 10, 2008 12:09 PM, Simser, Bil <Sim...@bantrel.com> wrote:
Dave,
 
I wanted to go in and write some more specs against the IoC wrapper in xeva. Before I went and submitted a patch, I wanted to see what you thought of this. As I'm not 100% adept with the spec naming I wanted to see if I was on the right track or if you had suggestions. Part of it is to get coverage up, part is to get more understanding and see if the specs would be describing enough over xml comments.
 
Here's the updated specs I have so far:
 

    9     [TestFixture]

   10     public class Before_using_a_container : Spec

   11     {

   12         [Test]

   13         public void You_must_initialize_with_a_backing_windsor_container()

   14         {

   15             Assert.IsFalse(IoC.Initialized);

   16             IoC.Initialize(new WindsorContainer());

   17             Assert.IsTrue(IoC.Initialized);

   18             IoC.Reset();

   19         }

   20     }

   21 

   22     [TestFixture]

   23     public class When_using_a_container : Spec

   24     {

   25         [Test]

   26         public void You_should_be_able_to_resolve_a_generic_type()

   27         {

   28             IoC.Initialize(new WindsorContainer());

   29             IoC.AddComponent("", typeof(Spec ));

   30             Assert.AreEqual(IoC.Resolve<Spec>().GetType(), typeof(Spec));

   31             IoC.Reset();

   32         }

   33 

   34         [Test]

   35         public void You_should_be_able_to_resolve_a_generic_type_by_name()

   36         {

   37             IoC.Initialize(new WindsorContainer());

   38             IoC.AddComponent("test", typeof(Spec ));

   39             Assert.AreEqual(IoC.Resolve<Spec>( "test").GetType(), typeof(Spec));

   40             IoC.Reset();

   41         }

   42     }

   43 

   44     [TestFixture]

   45     public class When_a_container_is_reset : Spec

   46     {

   47         [Test]

   48         public void The_container_should_be_empied_out()

   49         {

   50             Assert.IsFalse(IoC.Initialized);

   51             IoC.Initialize(new WindsorContainer());

   52             IoC.Reset();

   53             Assert.IsFalse(IoC.Initialized);

   54         }

   55     }

   56 

   57     [TestFixture]

   58     public class When_adding_a_component_to_the_container : Spec

   59     {

   60         [Test]

   61         public void The_new_component_should_resolved_after_being_added()

   62         {

   63             IoC.Initialize(new WindsorContainer());

   64             IoC.AddComponent("test", typeof(Spec ));

   65             Assert.AreEqual(IoC.Resolve("test").GetType(), typeof(Spec));

   66             IoC.Reset();

   67         }

   68 

   69         [Test]

   70         [ExpectedException(typeof(InvalidOperationException))]

   71         public void An_InvalidOperationException_should_be_thrown_if_the_container_is_not_initialized()

   72         {

   73             IoC.AddComponent("test", typeof(Spec ));

   74             IoC.Reset();

   75             Assert.Fail("Should have thrown exception of type InvalidOperationException");

   76         }

   77     }

 

And here's the CC.NET page I have setup which pumps out a spec report (from the mbunit xml):

 

Container specs

When a container is reset
  • The container should be empied out
When using a container
  • You should be able to resolve a generic type
  • You should be able to resolve a generic type by name
Before using a container
  • You must initialize with a backing windsor container
When adding a component to the container
  • The new component should resolved after being added
  • An InvalidOperationException should be thrown if the container is not initialized

This e-mail and any attachments may contain confidential and
privileged information. If you are not the intended recipient,
please notify the sender immediately by return e-mail, delete
this e-mail and destroy any copies.

Any dissemination or use of this information by a person other
than the intended recipient is unauthorized and may be illegal.




--


/ Dave

http://thebeelog.com

Bil Simser

unread,
Jan 10, 2008, 4:42:11 PM1/10/08
to xeva
So I take it I'm on the right track then? Fair enough.

I'll cut you a svn patch later to make it easier to merge.

On Jan 10, 1:35 pm, "David Laribee" <lari...@gmail.com> wrote:
> Awesome Bil. We will add them in next time we touch the code!
>
> > Container specs *When a container is reset*
>
> > - The container should be empied out
>
> > *When using a container*
>
> > - You should be able to resolve a generic type
>
> > - You should be able to resolve a generic type by name
>
> > *Before using a container*
>
> > - You must initialize with a backing windsor container
>
> > *When adding a component to the container*
>
> > - The new component should resolved after being added
>
> > - An InvalidOperationException should be thrown if the container is

Laribee

unread,
Jan 10, 2008, 6:26:15 PM1/10/08
to xe...@googlegroups.com
Already in!

Laribee

unread,
Jan 11, 2008, 12:52:21 AM1/11/08
to xe...@googlegroups.com
If you wouldn't mind verifying they are in the head of trunk

On Jan 10, 2008, at 4:42 PM, Bil Simser <ema...@bilsimser.com> wrote:

Reply all
Reply to author
Forward
0 new messages