简体   繁体   English

如何从 Microsoft.Sharepoint.Client.ZC6E190B28404933C48EZCE895E 中填充 Web class

[英]How to shim the Web class from Microsoft.Sharepoint.Client.Web?

I have a function that takes in an argument of type Web (Microsoft.Sharepoint.Client.Web).我有一个 function 接受类型为 Web 的参数(Microsoft.Sharepoint.Client.Web)。 I need to write the test case for the same but unfortunately, ShimWeb is not a thing according to Visual Studio and it suggests me to change it to ShimSPWeb which is not what I am using here.我需要为此编写测试用例,但不幸的是,根据 Visual Studio,ShimWeb 不是一个东西,它建议我将其更改为 ShimSPWeb,这不是我在这里使用的。 How to fix it?如何解决?

MY function is as follows:我的function如下:

 internal static bool EnsureFolders(string folderAbsolutePath, string folderRelativePath, string listName, ClientContext context, Web targetWeb, List spList)
{
            bool folderExists = false;

            Folder folder = null;
            folder = targetWeb.GetFolderByServerRelativeUrl(folderAbsolutePath);
            context.Load(folder);

            // .... something else to be done
}

Thanks in advance.提前致谢。

My unit test function is:我的单元测试 function 是:

 [TestMethod]
        public void EnsureFolders_ShouldConfirmExistenceOrCreateFolders()
        {
            using (ShimsContext.Create())
            {
                ShimWeb.AllInstances.GetFolderByServerRelativeUrlString(arg) => {}; // this line throws in errors like I mentioned above.
            }
        }

Need to add Microsoft.SharePoint.Client.Runtime dll to the references and use需要将Microsoft.SharePoint.Client.Runtime dll添加到引用中并使用

ShimClientRuntimeContext.AllInstances.LoadOf1M0ExpressionOfFuncOfM0ObjectArray<ListItem>((sender, a, b) => { // Something to be done });

for the shim purpose用于垫片目的

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 继承自Web客户端类 - Inheriting from the web client class 如何从类Microsoft.SharePoint.Client.ListItem中获取字段类型(整数,日期时间,选择)? - how do you get the field type (integer, datetime, choice) from the class Microsoft.SharePoint.Client.ListItem? 如何将 Microsoft.Sharepoint.Client.ListItem 转换为 Microsoft.Sharepoint.Client.File? - How to convert from Microsoft.Sharepoint.Client.ListItem to Microsoft.Sharepoint.Client.File? 如何使用Microsoft Fakes Shim隔离(绕道)类的构造函数? - How to Isolate (detour) constructor of class with Microsoft Fakes Shim? Microsoft客户端-Java Web服务 - Microsoft Client - Java Web Service 如何从Microsoft.SharePoint.Client.ListItem检索所有属性? - How to retrieve all properties from Microsoft.SharePoint.Client.ListItem? 如何使用Microsoft Fakes来填充DbContext? - How to Shim DbContext with Microsoft Fakes? Microsoft伪造品:尝试对类进行填充,但依存关系仍然存在 - Microsoft Fakes: Trying to shim a class but dependencies are still there 如何使用 Microsoft WCF Web 服务参考提供程序客户端正确使用在 web 服务上定义的 SendDataAsync 方法? - How to properly use SendDataAsync method defined on the web service using Microsoft WCF Web Service Reference Provider client? 如何序列化Microsoft.SharePoint.Client.ListItem(Sharepoint-2013)? - How to Serialize Microsoft.SharePoint.Client.ListItem (Sharepoint-2013)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM