小编Phi*_*hil的帖子

Nunit使用TestCaseSource运行TestCase,第一次迭代没有参数?为什么?

嗨,我是Nunit的新手,我将一系列对象作为TestCaseSource传递给TestCase.出于某种原因,虽然Nunit似乎首先运行测试,没有传递给它的参数,这导致忽略输出:

考试:

private readonly object[] _nunitIsWeird =
{
    new object[] {new List<string>{"one", "two", "three"}, 3},
    new object[] {new List<string>{"one", "two"}, 2}

};

[TestCase, TestCaseSource("_nunitIsWeird")]
public void TheCountsAreCorrect(List<string> entries, int expectedCount)
{
    Assert.AreEqual(expectedCount,Calculations.countThese(entries));
}
Run Code Online (Sandbox Code Playgroud)

TheCountsAreCorrect(3次测试),失败:一个或多个子测试有错误TheCountsAreCorrect(),忽略:没有提供参数TheCountsAreCorrect(System.Collections.Generic.List 1[System.String],2), Success TheCountsAreCorrect(System.Collections.Generic.List1 [System.String],3),成功

因此,第一个测试被忽略,因为没有参数,但我不希望这个测试运行,永远,它没有意义,它正在破坏我的测试输出.我尝试忽略它并正确设置测试输出但是当我再次运行所有测试时它会回来.

有什么我想念的东西,我到处寻找.

c# nunit unit-testing testcase testcasesource

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

TableRow中的Android固定宽度EditText

我完全不想尝试在TableRow中获得固定宽度的EditText小部件.我试图并排放置两个相同宽度的EditText(大约20dip),但无论我尝试哪个属性,设置第一个EditText都是很长的方式,显然无法调整大小.

非常感谢:

<TableRow 
  android:layout_height="wrap_content"
  android:baselineAligned="false" 
  android:id="@+id/tableRow3" 
  android:gravity="center"
  android:stretchColumns="1" 
  android:layout_width="match_parent">
  <TextView 
    android:id="@+id/textView6" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="1" 
    android:paddingLeft="36dip">
  </TextView>
  <EditText
    android:layout_height="wrap_content" 
    android:id="@+id/editText2" 
    android:inputType="number" 
    android:layout_width="20dip">
  </EditText>
  <EditText 
    android:layout_height="wrap_content" 
    android:id="@+id/editText1" 
    android:inputType="number"
    android:layout_width="wrap_content">
    <requestFocus></requestFocus>
  </EditText>
</TableRow>
Run Code Online (Sandbox Code Playgroud)

android android-edittext

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

C#JsonConvertDeserialization返回空值

我试图理解为什么我得到以下值的空值:

JSON:

{
  "IdentityService": {
    "IdentityTtlInSeconds": "90",
    "LookupDelayInMillis": "3000"
  }
}
Run Code Online (Sandbox Code Playgroud)

类:

public class IdentityService
{
    public string IdentityTtlInSeconds { get; set; }

    public string LookupDelayInMillis { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

叫:

  _identityService = JsonConvert.DeserializeObject<IdentityService>(itemAsString);
Run Code Online (Sandbox Code Playgroud)

该类已实例化,但IdentityTtlInSeconds和LookupDelayInMillis的值为null.我不明白为什么他们应该这样

c# json json.net deserialization

4
推荐指数
1
解决办法
56
查看次数

npm 构建失败,类扩展值未定义不是构造函数或 null

我已经查看了类似问题的其他答案,但我对 npm 不够熟悉,无法将它们转化为我所看到的内容。我正在尝试构建一个项目,但收到错误:

     ERROR  TypeError: Class extends value undefined is not a constructor or null
TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (D:\Development\Website\prosystem88\node_modules\mini-css-extract-plugin\dist\CssDependency.js:12:46)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (D:\Development\Website\prosystem88\node_modules\mini-css-extract-plugin\dist\index.js:12:45)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
Run Code Online (Sandbox Code Playgroud)

....还有更多内容,但我认为这是唯一相关的部分,如果不是,请告诉我

index.js 区域:

     ERROR  TypeError: Class extends value undefined is not a constructor or null
TypeError: Class extends value undefined is not a constructor …
Run Code Online (Sandbox Code Playgroud)

build npm

4
推荐指数
1
解决办法
8983
查看次数

使用查找表时的SQL SELECT语句

对不起,如果我没有正确地解决这个问题,但我对SQL报表很新,我似乎无法做到这一点我需要帮助解决如何SELECT使用查找表进行声明,情况如下:

Employee table
[ID], [Name], [StartDate]

User_Roles (lookup) table
[Employee_ID], [Role_ID]

Roles Table
[Id], [RoleName]
Run Code Online (Sandbox Code Playgroud)

所以,从我可以看到它employee有一个ID,名称和StartDate,

User_Roles表将角色ID分配给用户ID

Roles Table角色代码.

我需要一个返回的Select语句:

Employee.ID, Employee.Name, Employee.StartDate, Roles.RoleName
Run Code Online (Sandbox Code Playgroud)

根据映射在User_Roles表中的内容.

非常感谢您的帮助

sql sql-server

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

根据模式匹配的indext搜索List <>的一部分

我试图定义一个LINQ响应这个问题,我有一个List<List<string>>,我需要比较内部列表的第一行,并根据匹配返回该列表:

List<List<string>> mainList = new List<List<string>>();
List<string>lines = new List<string>();
lines.Add("one");
lines.Add("two");
lines.Add("three");
mainList.Add(lines);
lines=new List<string>();
lines.Add("bus");
lines.Add("clock");
lines.Add("chicken");
mainList.Add(lines);
Run Code Online (Sandbox Code Playgroud)

如何使用LINQ返回包含的整个列表"bus"

c# linq

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