public void Setup() { CorrelationUri = new Uri("msmq://bob/fitzgerald"); CorrelationId = Guid.NewGuid(); Saga = new LegacySubscriptionClientSaga(CorrelationId); MockBus = MockRepository.GenerateStub <IServiceBus>(); MockBus.Stub(x => x.Endpoint).Return(new NullEndpoint()); Saga.Bus = MockBus; }
public void Then() { var message = new LegacySubscriptionClientAdded { ClientId = CorrelationId, ControlUri = MockBus.Endpoint.Uri, DataUri = CorrelationUri, }; MockBus.AssertWasCalled(bus => bus.Publish(message)); }
public void MessageShouldBePublished() { var msg = new LegacySubscriptionClientAdded { ClientId = CorrelationId, ControlUri = MockBus.Endpoint.Uri, DataUri = CorrelationUri }; MockBus.AssertWasCalled(bus => bus.Publish(msg)); }
public void Setup() { CorrelationUri = new Uri("msmq://bob/fitzgerald"); CorrelationId = Guid.NewGuid(); Saga = new LegacySubscriptionClientSaga(CorrelationId); MockBus = MockRepository.GenerateStub <IServiceBus>(); MockBus.Stub(x => x.Endpoint).Return(new NullEndpoint()); Saga.Bus = MockBus; var data = new OldCacheUpdateRequest(CorrelationUri); Saga.RaiseEvent(LegacySubscriptionClientSaga.OldCacheUpdateRequested, data); }
public void should_have_ttl_in_future() { var mockBus = new MockBus(); var dodgyProcess = new DodgyProcess(mockBus); dodgyProcess.Handle(new OrderPaid(new Order())); var publishedMessage = mockBus.Messages[0]; var tolerance = TimeSpan.FromHours(1); var ttl = ((IHaveTtl)publishedMessage).expiry - DateTimeOffset.Now; Assert.That(ttl, Is.GreaterThanOrEqualTo(tolerance)); }
public void SetUp() { bus = new MockBus(); rawByteBus = new MockRawByteBus(); scheduleRepository = new MockScheduleRepository(); schedulerService = new SchedulerService( bus, rawByteBus, new ConsoleLogger(), scheduleRepository, () => now); }
public void EstablishContext() { MockBus = MockRepository.GenerateStub <IServiceBus>(); MockBus.Stub(b => b.Endpoint).Return(new NullEndpoint()); MockEndpointFactory = MockRepository.GenerateStub <IEndpointFactory>(); MockRepo = MockRepository.GenerateStub <ISagaRepository <LegacySubscriptionClientSaga> >(); MockNewSubEndpoint = MockRepository.GenerateStub <IEndpoint>(); MockEndpointFactory.Stub(e => e.GetEndpoint("msmq://localhost/new_subservice")).Return(MockNewSubEndpoint); Service = new LegacySubscriptionProxyService(MockRepo, MockEndpointFactory, MockBus); Service.Start(); }
public void should_retry_twice() { var bus = new MockBus(); var londonProcess = new LondonProcess(bus); var order = new Order(); londonProcess.Handle(new OrderPlaced(order)); londonProcess.Handle(new CookOrderTimedOut(order)); londonProcess.Handle(new CookOrderTimedOut(order)); var count = bus.Messages.OfType <CookFood>().Count(); Assert.That(count, Is.EqualTo(3)); }
public CPUTests(ITestOutputHelper testOutputHelper) { _logger = new TestOutputLogger(testOutputHelper); _clock = Substitute.For <IClock>(); _cpuExecutionCompletedTokenSource = new CancellationTokenSource(); _bytes = new byte[0xFFFF]; _bytes[CPU.ResetVectorAddressLow] = 0x4C; //JMP _bytes[CPU.ResetVectorAddressLow + 1] = ProgramStartLabel.LowOrderByte(); _bytes[CPU.ResetVectorAddressLow + 2] = ProgramStartLabel.HighOrderByte(); _bus = new MockBus(_clock, _bytes); _cpu = new CPU(_bus, _cpuExecutionCompletedTokenSource, _logger); //Add a fake instruction for unit tests to have an exit point. _cpu.AddNonStandardInstruction(new GracefulExitInstruction(_cpuExecutionCompletedTokenSource)); }
public void SetUp() { bus = new MockBus(); rawByteBus = new MockRawByteBus(); scheduleRepository = new MockScheduleRepository(); schedulerService = new SchedulerService( bus, rawByteBus, new ConsoleLogger(), scheduleRepository, new SchedulerServiceConfiguration { PublishIntervalSeconds = 1, PurgeIntervalSeconds = 1 }); }
public override void Setup() { base.Setup(); bus = new MockBus(); messagePublisher = new MockMessagePublisher(bus); executor = new ActionExecutor(bus); executor.LogToConsole = true; executor.OnFailedAssertionThrow <AssertionException>(); crm = new Crm(messagePublisher); accounting = new Accounting(messagePublisher); stock = new Stock(messagePublisher); bus.Consume <ProductPurchased>(consumerServiceName, crm); bus.Consume <ProductPurchased>(consumerServiceName, accounting); bus.Consume <PurchaseProduct>(consumerServiceName, stock); bus.Consume <ProductReceivedFromSupplier>(consumerServiceName, stock); }
private void addBindings() { //_ninjectKernel.Bind<IExpensesRepository>().To<ExpensesRepository>(); //_ninjectKernel.Bind<IExpensesRepository>().To<ExpensesRepository>().InSingletonScope(); _ninjectKernel.Bind <IExpensesRepository>().ToConstant(MockBus.Get().MockExpensesRep.Object); }
public void ShouldSubscribeToSaga() { MockBus.AssertWasCalled(b => b.Subscribe <LegacySubscriptionClientSaga>()); }
public void ShouldSubscribeItself() { MockBus.AssertWasCalled(b => b.Subscribe(Service)); }
public MockMessagePublisher(MockBus bus) { this.bus = bus; }