小编Car*_*rol的帖子

更快地创建测试方法

我喜欢创建我的测试方法,如:

Should_not_allow_negative_number_in_value()
Run Code Online (Sandbox Code Playgroud)

但每次输入_都很无聊,而且它总是有相同的签名......

所以...有谁知道让它更快?

谢谢!

.net c# unit-testing visual-studio

6
推荐指数
1
解决办法
1846
查看次数

使用DotNetOpenAuth从OpenID Provider获取电子邮件地址

我无法获取GetExtension方法中返回的电子邮件地址,但它包含在Google(我正在测试的OP)发回给我的网址中.

if (Page.IsPostBack)
{
    using (var openid = new OpenIdRelyingParty())
    {
        var request = openid.CreateRequest(Request.Form["openid_identifier"]);

        var fetch = new FetchRequest();
        fetch.Attributes.Add(new AttributeRequest(WellKnownAttributes.Contact.Email, true));

        request.AddExtension(fetch);

        request.RedirectToProvider();
    }
}
else
{
    using (var openid = new OpenIdRelyingParty())
    {
        var response = openid.GetResponse();
        if (response != null)
        {
            switch (response.Status)
            {
                case AuthenticationStatus.Authenticated:
                    var claimsResponse = response.GetExtension<FetchRequest>();
                    break;
                case AuthenticationStatus.Canceled:
                    //this.loginCanceledLabel.Visible = true;
                    break;
                case AuthenticationStatus.SetupRequired:
                    //this.loginFailedLabel.Visible = true;
                    break;

                // We don't need to handle SetupRequired because we're not setting …
Run Code Online (Sandbox Code Playgroud)

.net c# dotnetopenauth

6
推荐指数
1
解决办法
3247
查看次数

在asp.net中获取绝对的Url

当我使用visual studio运行我的网站时,它的根URL是: http://localhost:4657

我有包含路径的字符串~/Login.aspx,我需要连接它们以便返回http://localhost:4657/Login.aspx.

我可以看到很多方法来做到这一点,但正确的方法是什么?

asp.net

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

.net ×2

c# ×2

asp.net ×1

dotnetopenauth ×1

unit-testing ×1

visual-studio ×1