Commit e224956
Changed files (9)
trunk
build
lib
test
bdd.doc
src
MyMoney
Infrastructure
Threading
Presentation
Testing
spechelpers
contexts
trunk/build/lib/test/bdd.doc/bdddoc.dll
Binary file
trunk/src/MyMoney/Infrastructure/Threading/interval_timer_specs.cs
@@ -41,45 +41,35 @@ namespace MyMoney.Infrastructure.Threading
because b = () => sut.start_notifying(client, new TimeSpan(0, 10, 0));
}
- [Concern(typeof (interval_timer))]
- public class when_starting_a_timer_for_an_existing_client : old_context_specification<ITimer>
+ public class when_starting_a_timer_for_an_existing_client : behaves_like_an_interval_timer
{
- ITimerFactory factory;
- ITimerClient client;
- Timer first_timer;
- Timer second_timer;
+ it should_stop_the_previously_started_timer = () =>
+ {
+ first_timer.was_told_to(t => t.Stop());
+ first_timer.was_told_to(t => t.Dispose());
+ };
- [Observation]
- public void should_stop_the_previously_started_timer()
- {
- first_timer.was_told_to(t => t.Stop());
- first_timer.was_told_to(t => t.Dispose());
- }
-
- [Observation]
- public void should_start_a_new_timer()
- {
- second_timer.was_told_to(t => t.Start());
- }
+ it should_start_a_new_timer = () => second_timer.was_told_to(t => t.Start());
- protected override ITimer context()
- {
- factory = an<ITimerFactory>();
- client = an<ITimerClient>();
- first_timer = an<Timer>();
- second_timer = an<Timer>();
+ context c = () =>
+ {
+ client = an<ITimerClient>();
+ first_timer = dependency<Timer>();
+ second_timer = dependency<Timer>();
- factory.is_told_to(f => f.create_for(new TimeSpan(0, 1, 1))).Return(first_timer);
- factory.is_told_to(f => f.create_for(new TimeSpan(0, 2, 2))).Return(second_timer);
+ factory.is_told_to(f => f.create_for(new TimeSpan(0, 1, 1))).it_will_return(first_timer);
+ factory.is_told_to(f => f.create_for(new TimeSpan(0, 2, 2))).it_will_return(second_timer);
+ };
- return new interval_timer(factory);
- }
+ because b = () =>
+ {
+ sut.start_notifying(client, new TimeSpan(0, 1, 1));
+ sut.start_notifying(client, new TimeSpan(0, 2, 2));
+ };
- protected override void because()
- {
- sut.start_notifying(client, new TimeSpan(0, 1, 1));
- sut.start_notifying(client, new TimeSpan(0, 2, 2));
- }
+ static ITimerClient client;
+ static Timer first_timer;
+ static Timer second_timer;
}
public class when_a_timer_elapses : behaves_like_an_interval_timer
trunk/src/MyMoney/Testing/MetaData/ConcernAttribute.cs
@@ -2,14 +2,10 @@ using System;
namespace MyMoney.Testing.MetaData
{
- [AttributeUsage(AttributeTargets.Class)]
- public class ConcernAttribute : Attribute
+ public class ConcernAttribute : bdddoc.core.ConcernAttribute
{
- public ConcernAttribute(Type concern)
+ public ConcernAttribute(Type concern) : base(concern)
{
- Concern = concern;
}
-
- public Type Concern { get; private set; }
}
}
\ No newline at end of file
trunk/src/MyMoney/Testing/MetaData/Observation.cs
@@ -1,10 +0,0 @@
-using System;
-using MbUnit.Core.Framework;
-
-namespace MyMoney.Testing.MetaData
-{
- [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
- public class ObservationAttribute : TestPatternAttribute
- {
- }
-}
\ No newline at end of file
trunk/src/MyMoney/Testing/MetaData/Observations.cs
@@ -1,20 +0,0 @@
-using System;
-using MbUnit.Core.Framework;
-using MbUnit.Core.Runs;
-using MbUnit.Framework;
-
-namespace MyMoney.Testing.MetaData
-{
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
- public class Observations : TestFixturePatternAttribute
- {
- public override IRun GetRun()
- {
- var run = new SequenceRun();
- run.Runs.Add(new OptionalMethodRun(typeof (SetUpAttribute), false));
- run.Runs.Add(new MethodRun(typeof (ObservationAttribute), true, true));
- run.Runs.Add(new OptionalMethodRun(typeof (TearDownAttribute), false));
- return run;
- }
- }
-}
\ No newline at end of file
trunk/src/MyMoney/Testing/spechelpers/contexts/old_context_specification.cs
@@ -1,38 +0,0 @@
-using MbUnit.Framework;
-using MyMoney.Testing.MetaData;
-using Rhino.Mocks;
-
-namespace MyMoney.Testing.spechelpers.contexts
-{
- [Observations]
- public abstract class old_context_specification<SystemUnderTest>
- {
- protected SystemUnderTest sut { get; private set; }
-
- [SetUp]
- public virtual void before_each_specification()
- {
- sut = context();
- because();
- }
-
- [TearDown]
- public virtual void after_each_specification()
- {
- }
-
- protected abstract SystemUnderTest context();
-
- protected abstract void because();
-
- protected TypeToMock an<TypeToMock>() where TypeToMock : class
- {
- return MockRepository.GenerateMock<TypeToMock>();
- }
-
- protected T when_the<T>(T item)
- {
- return item;
- }
- }
-}
\ No newline at end of file
trunk/src/MyMoney/MyMoney.csproj
@@ -39,6 +39,10 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\build\lib\app\active.reports\ActiveReports3.dll</HintPath>
</Reference>
+ <Reference Include="bdddoc, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\build\lib\test\bdd.doc\bdddoc.dll</HintPath>
+ </Reference>
<Reference Include="Castle.Core, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\build\lib\app\castle\Castle.Core.dll</HintPath>
@@ -397,9 +401,6 @@
<Compile Include="Testing\spechelpers\contexts\concerns_for.cs" />
<Compile Include="Testing\spechelpers\contexts\behaves_like_a_repository.cs" />
<Compile Include="Testing\spechelpers\core\IHideObjectMembers.cs" />
- <Compile Include="Testing\MetaData\Observation.cs" />
- <Compile Include="Testing\MetaData\Observations.cs" />
- <Compile Include="Testing\spechelpers\contexts\old_context_specification.cs" />
<Compile Include="Testing\spechelpers\core\method_call_occurance.cs" />
<Compile Include="Testing\MetaData\run_in_real_container.cs" />
<Compile Include="Testing\spechelpers\core\BDDAssertions.cs" />
@@ -484,7 +485,6 @@
<DependentUpon>window_shell.cs</DependentUpon>
</Compile>
<Compile Include="Presentation\Views\Menu\Mappers\sub_menu_to_tool_strip_menu_item_mapper.cs" />
- <Compile Include="Presentation\Views\Menu\Mappers\sub_menu_to_tool_strip_menu_item_mapper_specs.cs" />
<Compile Include="Presentation\Context\the_application_context_specs.cs" />
<Compile Include="Presentation\Context\the_application_context.cs" />
<Compile Include="Presentation\Views\Startup\ISplashScreenView.cs" />