获取OData方法-单元测试

时间:2019-03-12 17:27:36

标签: c# unit-testing

尝试测试以下内容

// GET: odata/API_INSTANCE
    [EnableQuery]
    public SingleResult<API_INSTANCE> GetAPI_INSTANCE([FromODataUri] Guid key)
    {
     return SingleResult.Create(db.API_FIRM_LINK.Where(m => m.ApiFirmLinkId == key).Select(m => m.API_INSTANCE));
    }

这是我到目前为止的内容:不确定如何调用ODATA,GUID KEY。我问了一个与此相关的类似问题

   public void GetAPI_INSTANCETest()
    {

        ////Arrange
        API_FIRM_LINKController controller = new API_FIRM_LINKController();
        ////ACT
        controller.GetAPI_INSTANCE();
        SingleResult result = controller.GetAPI_INSTANCE() as SingleResult;
        ////Assert
        Assert.IsNotNull(result);
        Console.Write(result);

    }
}

0 个答案:

没有答案