public void Setup() { _serviceId = Guid.NewGuid(); _leaderId = Guid.NewGuid(); _endpoint = MockRepository.GenerateMock<IEndpoint>(); _endpoint.Expect(x => x.Send<Promise<string>>(null)).IgnoreArguments(); _endpoint.Stub(x => x.Uri).Return(new Uri("loopback://localhost/queue")); _endpointFactory = MockRepository.GenerateMock<IEndpointFactory>(); _endpointFactory.Stub(x => x.GetEndpoint((Uri)null)).IgnoreArguments().Return(_endpoint); _builder = MockRepository.GenerateMock<IObjectBuilder>(); _builder.Stub(x => x.GetInstance<IEndpointFactory>()).Return(_endpointFactory); _bus = MockRepository.GenerateMock<IServiceBus>(); _bus.Stub(x => x.Endpoint).Return(_endpoint); }