示例#1
0
        public void GetsDynamicUriFromStaticField()
        {
            var actual = UriFromType.Get(() => new Dynamic {
                Id = StaticIdTest
            });

            Assert.Equal("/dynamic/42", actual.ToString());
        }
示例#2
0
        public void GetsDynamicUriFromProperty()
        {
            var actual = UriFromType.Get(() => new Dynamic {
                Id = IdTest
            });

            Assert.Equal("/dynamic/42", actual.ToString());
        }
示例#3
0
        public void GetsDynamicUriFromConstant()
        {
            var actual = UriFromType.Get(() => new Dynamic {
                Id = 42
            });

            Assert.Equal("/dynamic/42", actual.ToString());
        }
示例#4
0
        public void GetsDynamicUriFromVariable()
        {
            int id     = 42;
            var actual = UriFromType.Get(() => new Dynamic {
                Id = id
            });

            Assert.Equal("/dynamic/42", actual.ToString());
        }
示例#5
0
        public Status Post(Login login)
        {
            string redirectLocation;

            if (login.UserName == "mark" && login.Password == "password")
            {
                redirectLocation  = string.IsNullOrWhiteSpace(login.ReturnUrl) ? "/" : login.ReturnUrl;
                this.LoggedInUser = new User(MarkGuid, "Mark");
            }
            else
            {
                redirectLocation = UriFromType.Get(() => new LoginForm {
                    ReturnUrl = login.ReturnUrl
                }).ToString();
            }

            return(Status.SeeOther(redirectLocation));
        }
示例#6
0
        public void GetsStaticUri()
        {
            var actual = UriFromType.Get <Static>();

            Assert.Equal("/static", actual.ToString());
        }