public virtual void Setup()
 {
   _mocks = new MockRepository();
   _services = _mocks.DynamicMock<ICodeGeneratorServices>();
   _controller = _mocks.DynamicMock<TestController>();
   _factory = new DefaultControllerReferenceFactory();
 }
		public virtual void Setup()
		{
			response = new StubResponse();
			var url = new UrlInfo("eleutian.com", "www", virtualDirectory, "http", 80, 
				Path.Combine(Path.Combine("Area", "Controller"), "Action"), "Area", "Controller", "Action", "rails", "");
			
			var stubEngineContext = new StubEngineContext(new StubRequest(), response, new StubMonoRailServices(), url)
			{
				Server = MockRepository.GenerateMock<IServerUtility>()
			};

			railsContext = stubEngineContext;
			serverUtility = railsContext.Server;

			argumentConversionService = MockRepository.GenerateMock<IArgumentConversionService>();

			controller = new TestController();
			controller.Contextualize(railsContext, MockRepository.GenerateStub<IControllerContext>());
			
			parameters = new Hashtable();
			
			services = MockRepository.GenerateMock<ICodeGeneratorServices>();
			services.Expect(s => s.ArgumentConversionService).Return(argumentConversionService).Repeat.Any();
			services.Expect(s => s.Controller).Return(controller).Repeat.Any();
			services.Expect(s => s.RailsContext).Return(railsContext).Repeat.Any();
			argumentConversionService.Expect(s => s.CreateParameters()).Return(parameters).Repeat.Any();
		}
		public void Setup()
		{
			_controller = new TestController();
			_mocks = new MockRepository();
			_controllerReferenceFactory = _mocks.DynamicMock<IControllerReferenceFactory>();
			_argumentConversionService = _mocks.DynamicMock<IArgumentConversionService>();
			_runtimeInformationService = _mocks.DynamicMock<IRuntimeInformationService>();
			_services = new DefaultCodeGeneratorServices(_controllerReferenceFactory, _argumentConversionService, _runtimeInformationService);
			_context = _mocks.DynamicMock<IEngineContext>();
			Assert.AreEqual(_controllerReferenceFactory, _services.ControllerReferenceFactory);
			Assert.AreEqual(_argumentConversionService, _services.ArgumentConversionService);
			Assert.AreEqual(_runtimeInformationService, _services.RuntimeInformationService);
		}
		public void Render_Always_SetsSelectedView()
		{
			Controller controller = new TestController();
			controller.ControllerContext = _mocks.Stub<IControllerContext>();
			ControllerViewReference reference =
				new ControllerViewReference(_services, typeof (TestController), "Area", "Test", "Action");

			using (_mocks.Unordered())
			{
				Expect.Call(_services.Controller).Return(controller).Repeat.Any();
			}

			_mocks.ReplayAll();
			reference.Render();
			_mocks.VerifyAll();

			Assert.AreEqual(@"Area\Test\Action", controller.SelectedViewName);
		}
		public virtual void Setup()
		{
			_mocks = new MockRepository();
			_services = _mocks.DynamicMock<ICodeGeneratorServices>();
			_response = new StubResponse();
			UrlInfo url =
				new UrlInfo("eleutian.com", "www", _virtualDirectory, "http", 80,
				            Path.Combine(Path.Combine("Area", "Controller"), "Action"), "Area", "Controller", "Action", "rails",
				            "");
			_railsContext =
				new StubEngineContext(new StubRequest(), _response, new StubMonoRailServices(), url);

			((StubEngineContext)_railsContext).Server = _mocks.DynamicMock<IServerUtility>();
			_serverUtility = _railsContext.Server;

			_argumentConversionService = _mocks.DynamicMock<IArgumentConversionService>();
			_controller = new TestController();
		}