Created
September 15, 2011 07:28
-
-
Save andreasohlund/1218735 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [TestFixture] | |
| public class When_a_endpoint_with_a_unknown_faultstore_starts_up | |
| { | |
| IHandleMessages<EndpointStarted> _handler; | |
| StructureMapAMC<EnsureFaultMonitoringOnEndpointStartup> _autoMocker; | |
| IFaultStoreMonitor _monitor; | |
| [SetUp] | |
| public void SetUp() | |
| { | |
| _autoMocker = new StructureMapAMC<EnsureFaultMonitoringOnEndpointStartup>(); | |
| _handler = _autoMocker.Create(); | |
| _monitor = MockRepository.GenerateStub<IFaultStoreMonitor>(); | |
| _monitor.Stub(x => x.GetAllMessages()).Return(new List<FaultDetails>()); | |
| _autoMocker.GetStub<IFaultStoreMonitorFactory>().Stub(f => f.GetMonitorFor(Arg<FaultStore>.Matches(s => s.Address == "error@server"))).Return(_monitor); | |
| _autoMocker.GetStub<IRepository>().Stub(s => s.Query(Arg<GetFaultStoreWithAddress>.Is.Anything)).Return( | |
| new List<FaultStore>().ToLinqResult()); | |
| _autoMocker.GetStub<IRepository>().Stub(s => s.Query(Arg<GetFaultsWithMessageIdNotInList>.Is.Anything)).Return( | |
| new List<Fault>().ToLinqResult()); | |
| } | |
| [Test] | |
| public void The_fault_store_should_be_monitored() | |
| { | |
| _handler.Handle(new EndpointStarted | |
| { | |
| FaultStore = new Store | |
| { | |
| Address = "error@server", | |
| Type = "MSMQ" | |
| } | |
| }); | |
| _monitor.AssertWasCalled(m=>m.Start(Arg<FaultStore>.Is.Anything)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment