public void Init() { _mockResponseHandler = MockRepository.GenerateStub <IExceptionResponseHandler>(); _controller = new HttpCallController(_mockResponseHandler); _mockProcessor = MockRepository.GenerateStub <IHttpCallProcessor>(); _mockProcessor.Stub(s => s.Method).Return("TEST"); _controller.RegisterCallProcessor(_mockProcessor); _mockWrapper = MockRepository.GenerateStub <INetworkStreamWrapper>(); }
public void RegisterCallProcessor_Adding_Same_Twice_Throws_ArgumentException() { // Arrange IHttpCallProcessor processor = MockRepository.GenerateStub <IHttpCallProcessor>(); processor.Stub(s => s.Method).Return("TEST"); // Act _controller.RegisterCallProcessor(processor); // Assert Assert.Throws <ArgumentException>(() => _controller.RegisterCallProcessor(processor)); }
public void RegisterCallProcessor_With_A_Call_Processor_Adds_Processor() { // Arrange IHttpCallProcessor processor = MockRepository.GenerateStub <IHttpCallProcessor>(); processor.Stub(s => s.Method).Return("TEST"); var preRegisterProcessorCount = _controller.CallProcessors.Count(); // Act _controller.RegisterCallProcessor(processor); var postRegisterProceessorCount = _controller.CallProcessors.Count(); // Assert Assert.AreEqual(0, preRegisterProcessorCount); Assert.AreEqual(1, postRegisterProceessorCount); Assert.AreSame(processor, _controller.CallProcessors.First().Value); }