public void ListItemProvider_Test_GetItems_UseStoredFile() { string siteUrl = "https://totally-mocked.sharepoint.com/sites/some-test-site"; using (ClientContext context = new ClientContext(siteUrl)) { MockExecutorFactory factory = UnitTestClientContextHelper.BuildExecutorFactory(false, "./../../../MockResponses/ListItemProvider_Test_GetItems_Integration.json"); context.WebRequestExecutorFactory = factory; ListItemProvider provider = new ListItemProvider(context); var myItems = provider.GetMyItems(); } }
public void ListItemProvider_Test_AddItems_ItemExists() { using (ClientContext context = new ClientContext("https://test.sharepoint.com/sites/test")) { MockExecutorFactory factory = UnitTestClientContextHelper.BuildExecutorFactory(false, "./../../../MockResponses/ListItemProvider_Test_AddItems_NoItemExists.json"); context.WebRequestExecutorFactory = factory; ListItemProvider provider = new ListItemProvider(context); provider.UpdateItem(new MyTestListItem() { Id = 1, Title = "Title" }); } }
public void ListItemProvider_Test_GetItems_Integration() { using (AuthenticationManager authManager = new AuthenticationManager(Common.User, EncryptionUtility.ToSecureString(Common.UserPassword))) { using (ClientContext context = authManager.GetContext(Common.SiteUrl)) { MockExecutorFactory factory = UnitTestClientContextHelper.BuildExecutorFactory(true, "./../../../MockResponses/ListItemProvider_Test_GetItems_Integration.json"); context.WebRequestExecutorFactory = factory; ListItemProvider provider = new ListItemProvider(context); var myItems = provider.GetMyItems(); factory.SaveMockData(); } } }