background

Telerik JustMock

Mock Microsoft SharePoint API

  • JustMock allows you to test your code in isolation by enabling you to mock any dependency, including Microsoft SharePoint API.
  • Part of the fastest, most flexible and complete mocking tool for crafting unit tests.
  • Our award-winning support team is available to assist you with any issues.
Mock everything
  • Mocking Microsoft SharePoint API Overview

    SharePoint is a web-based collaborative platform and a secure place to store, organize, share and access information from any device.

    JustMock allows you to test your code in isolation by enabling you to mock any dependency, including Microsoft SharePoint API.

    [TestMethod]
    public void PreviewOnHowToMockSPContext()
    {
        // Arrange
        var fakeSiteUrl = "https://www.telerik.com";
        var fakeSharepointSite = Mock.Create<SPSite>();
          
        Mock.Arrange(() => SPContext.Current.Site).Returns(fakeSharepointSite);
        Mock.Arrange(() => fakeSharepointSite.Url).Returns(fakeSiteUrl);
          
        // Act
        string actualUrl = Site.GetHomePageUrl();
          
        Assert.AreEqual(fakeSiteUrl, actualUrl);
    }

    Mock Microsoft Sharepoint documentation
Next Steps