Unable to use shims in MStest to fake a SharePoint in .net

72 Views Asked by At
public static SPListItemCollection GetItemsReadyForPublish(SPWeb tempWeb)
{
    SPList stagingLibrary = tempWeb.Lists["examplelibrary"];
    SPQuery CamlQuery = new SPQuery();
    CamlQuery.Query = $"<Where><Eq><FieldRef Name='{"DocumentStatus"}'/><Value Type='Text'>{"Ready For Publish""}</Value></Eq></Where>";
    CamlQuery.ViewAttributes = "Scope=\"Recursive\"";
    SPListItemCollection itemCollection = stagingLibrary.GetItems(CamlQuery);
    return itemCollection;
}

In this SharePoint, a lot of libraries are there and I want to grab the "examplelibrary".

Can some please help me in writing the test case for this function using shims. I am having a tough time faking the SharePoint list as there are no documents to refer and this is the first time I am doing it for a SharePoint.

1

There are 1 best solutions below

0
saumitra tiwari On BEST ANSWER