小编Raz*_*ack的帖子

在单元测试中使用Moq模拟认证用户

我们如何使用Moq框架模拟经过身份验证的用户.使用表单身份验证

我需要为下面的操作编写单元测试

public PartialViewResult MyGoals()
{
    int userid = ((SocialGoalUser)(User.Identity)).UserId;
    var Goals = goalService.GetMyGoals(userid);
    return PartialView("_MyGoalsView", Goals);
}
Run Code Online (Sandbox Code Playgroud)

我需要在这里模拟userid的值

c# asp.net-mvc unit-testing moq

9
推荐指数
1
解决办法
8734
查看次数

Kendo UI MVC4 网格列标题与数据不对齐

我正在使用 kendo UI MVC4 助手。我已经为每列设置了固定宽度,但是加载数据时数据和标题未对齐。然后,当调整任何列的大小时,所有列都将正确对齐(没有问题)。请让我知道加载内容时要签署的任何解决方案。我也使用分组。

请检查屏幕截图。

加载数据后

在此输入图像描述

调整任何列的大小后 在此输入图像描述

请检查我的 html 帮助器部分。

.....
.Columns(columns =>
                 {
                     columns.Bound(p => p.EvaluationDT_ID).Hidden(true);
                     columns.Bound(p => p.ItemID).Hidden(true);
                     columns.Bound(p => p.ItemName).Width("160px").HtmlAttributes(new { title = "#= ItemName #" }).Sortable(true);
                     columns.Bound(p => p.Itemcode).Width("80px");
                     columns.Bound(p => p.Brand).Width("90px").HtmlAttributes(new { title = "#= Brand #" });
                     columns.Bound(p => p.Weight).Width("50px").HtmlAttributes(new { style = "text-align: right" }).HeaderHtmlAttributes(new { style = "text-align:left;" });
                     columns.Bound(p => p.UOMCode).Width("50px");
                     columns.Bound(p => p.PackagingName).Width("50px");
......
Run Code Online (Sandbox Code Playgroud)

html css alignment asp.net-mvc-4 kendo-grid

5
推荐指数
1
解决办法
3766
查看次数

Zxing二维码解码函数在c#中返回null

使用下面的代码时我得到了空值。我正在使用从 NuGet 下载的 ZXing dll

    using ZXing.Common;
    using ZXing.QrCode;
    using ZXing.QrCode.Internal;

    private void Decode()
    {
        Bitmap bitmap = new Bitmap(@"D:\Project\QRCodes\myqrcode.png");
        try
        {
            MemoryStream memoryStream = new MemoryStream();
            bitmap.Save(memoryStream, ImageFormat.Bmp);

            byte[] byteArray = memoryStream.GetBuffer();

            ZXing.LuminanceSource source = new RGBLuminanceSource(byteArray, bitmap.Width, bitmap.Height);
            var binarizer = new HybridBinarizer(source);
            var binBitmap = new BinaryBitmap(binarizer);
            QRCodeReader qrCodeReader = new QRCodeReader();

            Result str = qrCodeReader.decode(binBitmap);

        }
        catch{ }

    }
Run Code Online (Sandbox Code Playgroud)

请给我一个解决方案 在此先感谢

c# decode qr-code zxing

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