예제 #1
0
        public void Transfer_MethodIsBad_Throws()
        {
            var argument = new ActionArgument(0, "name", "Jacob");

            New("Area", "Controller", "BadAction", argument);

            reference.Transfer();
        }
		public void Constructor_Always_ProperlyInitializes()
		{
			ActionArgument argument = new ActionArgument(0, "id", 1);
			Assert.AreEqual("id", argument.Name);
			Assert.AreEqual(typeof (Int32), argument.Type);
			Assert.AreEqual(1, argument.Value);
			Assert.AreEqual(0, argument.Index);
		}
 public void ConvertValue_Always_ReturnsSameValue()
 {
   string value = "Hello, World!";
   ActionArgument argument = new ActionArgument(0, "name", value);
   IDictionary parameters = new Hashtable();
   Assert.IsTrue(_service.ConvertArgument(null, argument, parameters));
   Assert.AreEqual(value, parameters["name"]);
 }
예제 #4
0
        public void Transfer_MethodIsReal_InvokesAction()
        {
            var argument = new ActionArgument(0, "name", "Jacob");

            New("Area", "Controller", "Index", argument);

            reference.Transfer();
        }
예제 #5
0
        public void Constructor_Always_ProperlyInitializes()
        {
            var argument = new ActionArgument(0, "id", 1);

            Assert.AreEqual("id", argument.Name);
            Assert.AreEqual(typeof(Int32), argument.Type);
            Assert.AreEqual(1, argument.Value);
            Assert.AreEqual(0, argument.Index);
        }
		public void Url_OneArgument_ReturnsUrl()
		{
			var argument = new ActionArgument(0, "name", "Jacob");
			New("Area", "Controller", "Action", argument);

			argumentConversionService.Expect(s => s.ConvertArgument(null, argument, parameters)).Return(true);
			serverUtility.Expect(s => s.UrlEncode("name")).Return("name");
			serverUtility.Expect(s => s.UrlEncode("Jacob")).Return("Jacob");
			parameters.Add("name", "Jacob");

			var actual = reference.Url;

			Assert.AreEqual("/Directory/Area/Controller/Action.rails?name=Jacob", actual);
		}
예제 #7
0
        public void Transfer_MethodIsBad_Throws()
        {
            ActionArgument argument = new ActionArgument(0, "name", "Jacob");

            New("Area", "Controller", "BadAction", argument);

            using (_mocks.Unordered())
            {
                SetupMocks();
            }

            _mocks.ReplayAll();
            _reference.Transfer();
        }
예제 #8
0
        public void Url_OneArgument_ReturnsUrl()
        {
            var argument = new ActionArgument(0, "name", "Jacob");

            New("Area", "Controller", "Action", argument);

            argumentConversionService.Expect(s => s.ConvertArgument(null, argument, parameters)).Return(true);
            serverUtility.Expect(s => s.UrlEncode("name")).Return("name");
            serverUtility.Expect(s => s.UrlEncode("Jacob")).Return("Jacob");
            parameters.Add("name", "Jacob");

            var actual = reference.Url;

            Assert.AreEqual("/Area/Controller/Action.rails?name=Jacob", actual);
        }
예제 #9
0
        public void Transfer_MethodIsReal_InvokesAction()
        {
            ActionArgument argument = new ActionArgument(0, "name", "Jacob");

            New("Area", "Controller", "Index", argument);

            using (_mocks.Unordered())
            {
                SetupMocks();
            }

            _mocks.ReplayAll();
            _reference.Transfer();
            _mocks.VerifyAll();
        }
		public void Redirect_OneArgumentWithArea_Redirects()
		{
			var argument = new ActionArgument(0, "name", "Jacob");
			New("Area", "Controller", "Action", argument);

			argumentConversionService.Expect(s => s.ConvertArgument(null, argument, parameters)).Return(true);
			serverUtility.Expect(s => s.UrlEncode("name")).Return("name");
			serverUtility.Expect(s => s.UrlEncode("Jacob")).Return("Jacob");
			parameters.Add("name", "Jacob");
			
			reference.Redirect();
			
			Assert.IsTrue(controller.Context.Response.WasRedirected);
			Assert.AreEqual("/Area/Controller/Action.rails?name=Jacob", response.RedirectedTo);
		}
예제 #11
0
        public void Redirect_OneArgumentWithArea_Redirects()
        {
            var argument = new ActionArgument(0, "name", "Jacob");

            New("Area", "Controller", "Action", argument);

            argumentConversionService.Expect(s => s.ConvertArgument(null, argument, parameters)).Return(true);
            serverUtility.Expect(s => s.UrlEncode("name")).Return("name");
            serverUtility.Expect(s => s.UrlEncode("Jacob")).Return("Jacob");
            parameters.Add("name", "Jacob");

            reference.Redirect();

            Assert.IsTrue(controller.Context.Response.WasRedirected);
            Assert.AreEqual("/Area/Controller/Action.rails?name=Jacob", response.RedirectedTo);
        }
예제 #12
0
        public void Url_OneArgument_ReturnsUrl()
        {
            ActionArgument argument = new ActionArgument(0, "name", "Jacob");

            New("Area", "Controller", "Action", argument);

            using (_mocks.Unordered())
            {
                SetupMocks();
                Expect.Call(_argumentConversionService.ConvertArgument(null, argument, _parameters)).Return(true);
                Expect.Call(_serverUtility.UrlEncode("name")).Return("name");
                Expect.Call(_serverUtility.UrlEncode("Jacob")).Return("Jacob");
                _parameters.Add("name", "Jacob");
            }

            _mocks.ReplayAll();
            string actual = _reference.Url;

            _mocks.VerifyAll();
            Assert.AreEqual("/Directory/Area/Controller/Action.rails?name=Jacob", actual);
        }
예제 #13
0
        public void Redirect_OneArgumentWithArea_Redirects()
        {
            ActionArgument argument = new ActionArgument(0, "name", "Jacob");

            New("Area", "Controller", "Action", argument);

            using (_mocks.Unordered())
            {
                SetupMocks();
                Expect.Call(_argumentConversionService.ConvertArgument(null, argument, _parameters)).Return(true);
                Expect.Call(_serverUtility.UrlEncode("name")).Return("name");
                Expect.Call(_serverUtility.UrlEncode("Jacob")).Return("Jacob");
                _parameters.Add("name", "Jacob");
            }

            _mocks.ReplayAll();
            _reference.Redirect();
            _mocks.VerifyAll();

            Assert.IsTrue(this._controller.Context.Response.WasRedirected);
            Assert.AreEqual("/Area/Controller/Action.rails?name=Jacob", _response.RedirectedTo);
        }
		public void Transfer_MethodIsReal_InvokesAction()
		{
			ActionArgument argument = new ActionArgument(0, "name", "Jacob");
			New("Area", "Controller", "Index", argument);

			using (_mocks.Unordered())
			{
				SetupMocks();
			}

			_mocks.ReplayAll();
			_reference.Transfer();
			_mocks.VerifyAll();
		}
		public void Redirect_OneArgumentWithArea_Redirects()
		{
			ActionArgument argument = new ActionArgument(0, "name", "Jacob");
			New("Area", "Controller", "Action", argument);

			using (_mocks.Unordered())
			{
				SetupMocks();
				Expect.Call(_argumentConversionService.ConvertArgument(null, argument, _parameters)).Return(true);
				Expect.Call(_serverUtility.UrlEncode("name")).Return("name");
				Expect.Call(_serverUtility.UrlEncode("Jacob")).Return("Jacob");
			  _parameters.Add("name", "Jacob");
			}

			_mocks.ReplayAll();
			_reference.Redirect();
			_mocks.VerifyAll();

			Assert.IsTrue(this._controller.Context.Response.WasRedirected);
			Assert.AreEqual("/Area/Controller/Action.rails?name=Jacob", _response.RedirectedTo);
		}
		public void Transfer_MethodIsBad_Throws()
		{
			ActionArgument argument = new ActionArgument(0, "name", "Jacob");
			New("Area", "Controller", "BadAction", argument);

			using (_mocks.Unordered())
			{
				SetupMocks();
			}

			_mocks.ReplayAll();
			_reference.Transfer();
		}
		public void Transfer_MethodIsBad_Throws()
		{
			var argument = new ActionArgument(0, "name", "Jacob");
			New("Area", "Controller", "BadAction", argument);

			reference.Transfer();
		}
		public void Transfer_MethodIsReal_InvokesAction()
		{
			var argument = new ActionArgument(0, "name", "Jacob");
			New("Area", "Controller", "Index", argument);

			reference.Transfer();
		}
		public void Url_OneArgument_ReturnsUrl()
		{
			ActionArgument argument = new ActionArgument(0, "name", "Jacob");
			New("Area", "Controller", "Action", argument);

			using (_mocks.Unordered())
			{
				SetupMocks();
				Expect.Call(_argumentConversionService.ConvertArgument(null, argument, _parameters)).Return(true);
				Expect.Call(_serverUtility.UrlEncode("name")).Return("name");
				Expect.Call(_serverUtility.UrlEncode("Jacob")).Return("Jacob");
			  _parameters.Add("name", "Jacob");
			}

			_mocks.ReplayAll();
			string actual = _reference.Url;
			_mocks.VerifyAll();
			Assert.AreEqual("/Directory/Area/Controller/Action.rails?name=Jacob", actual);
		}
 public bool ConvertArgument(MethodSignature signature, ActionArgument argument, IDictionary parameters)
 {
   parameters.Add(argument.Name, argument.Value);
   return true;
 }