我试图完成这项工作并进行了许多google/stackoverflow搜索而根本没有运气.
我有一个简单的模型:
public class MovieModel
{
public string Id { get; set; }
[Required]
[StringLength(100)]
public string Name { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
控制器中的方法:
// POST: api/Movies
public IHttpActionResult Post([FromBody]MovieModel movieModel)
{
if (ModelState.IsValid)
{
//Code
}
}
Run Code Online (Sandbox Code Playgroud)
一个测试方法(是一个集成测试,但在单元测试中会发生同样的情况):
[TestMethod]
public void MoviesController_Post_Without_Name()
{
// Arrange
var model = new MovieModel();
model.Name = "";
// Act
var result = controller.Post(model);
// Assert
Assert.IsInstanceOfType(result, typeof(InvalidModelStateResult));
Assert.AreEqual(6, controller.Get().Count());
}
Run Code Online (Sandbox Code Playgroud)
尽管模型显然无效,但它总是将IsValid属性评估为true.
到目前为止,我尝试了许多方法但没有成
我很难完成这项工作。我的图像集由小图像 (58x65) 组成。
我正在使用带有以下参数的 ORB:
# Initiate ORB detector
# default: ORB(int nfeatures=500, float scaleFactor=1.2f, int nlevels=8, int edgeThreshold=31, int firstLevel=0, int WTA_K=2, int scoreType=ORB::HARRIS_SCORE, int patchSize=31)
orb = cv2.ORB_create(
nfeatures = 500, # The maximum number of features to retain.
scaleFactor = 1.2, # Pyramid decimation ratio, greater than 1
nlevels = 8, # The number of pyramid levels.
edgeThreshold = 7, # This is size of the border where the features are not detected. It should roughly match …Run Code Online (Sandbox Code Playgroud)