public void CanAccessFarm_ReturnsFalse_WhenSPFarmLocalNull() { SharePointEnvironment.Reset(); MockApplicationContextProvider.Reset(); MockApplicationContextProvider appContextProvider = new MockApplicationContextProvider(); SharePointEnvironment.ApplicationContextProvider = appContextProvider; MockApplicationContextProvider.SPFarmLocal = null; Assert.IsFalse(SharePointEnvironment.CanAccessFarm); }
public void CanAccessSharePoint_ReturnsTrue_WithSandBoxInAppDomainName() { SharePointEnvironment.Reset(); MockApplicationContextProvider.Reset(); MockApplicationContextProvider appContextProvider = new MockApplicationContextProvider(); SharePointEnvironment.ApplicationContextProvider = appContextProvider; MockApplicationContextProvider.AppDomainFriendlyName = "MySandboxAppDomain"; Assert.IsTrue(SharePointEnvironment.CanAccessSharePoint); }
public void ProxyInstalled_ReturnsFalse_WhenApplicationContextReturnsFalse() { SharePointEnvironment.Reset(); MockApplicationContextProvider.Reset(); MockApplicationContextProvider appContextProvider = new MockApplicationContextProvider(); SharePointEnvironment.ApplicationContextProvider = appContextProvider; MockApplicationContextProvider.IsProxyCheckerInstalledRetVal = false; Assert.IsFalse(SharePointEnvironment.ProxyInstalled("namespaceForProxy", "typeForProxy")); }
public void InSandBox_ReturnsFalse_WithoutSandBoxInAppDomainName() { SharePointEnvironment.Reset(); MockApplicationContextProvider.Reset(); MockApplicationContextProvider appContextProvider = new MockApplicationContextProvider(); SharePointEnvironment.ApplicationContextProvider = appContextProvider; MockApplicationContextProvider.AppDomainFriendlyName = "MyAppDomain"; Assert.IsFalse(SharePointEnvironment.InSandbox); }
public void ProxyInstalled_ReturnsTrue_WhenExecuteProxyOperationReturnsTrue() { SharePointEnvironment.Reset(); MockApplicationContextProvider.Reset(); MockApplicationContextProvider appContextProvider = new MockApplicationContextProvider(); SharePointEnvironment.ApplicationContextProvider = appContextProvider; MockApplicationContextProvider.ExecuteRegisteredProxyOperationRetVal = true; Assert.IsTrue(SharePointEnvironment.ProxyInstalled("namespaceForProxy", "typeForProxy")); }
public void CanAccessSharePoint_ReturnsFalse_WhenNotInSandboxAndSPFarmLocalNull() { SharePointEnvironment.Reset(); MockApplicationContextProvider.Reset(); MockApplicationContextProvider appContextProvider = new MockApplicationContextProvider(); SharePointEnvironment.ApplicationContextProvider = appContextProvider; MockApplicationContextProvider.AppDomainFriendlyName = "MyAppDomain"; MockApplicationContextProvider.SPFarmLocal = null; Assert.IsFalse(SharePointEnvironment.CanAccessSharePoint); }
public void ProxyInstalled_CachesRetVal_IfPreviouslyDeterminedFalse() { SharePointEnvironment.Reset(); MockApplicationContextProvider.Reset(); MockApplicationContextProvider appContextProvider = new MockApplicationContextProvider(); SharePointEnvironment.ApplicationContextProvider = appContextProvider; MockApplicationContextProvider.IsProxyCheckerInstalledRetVal = false; Assert.IsFalse(SharePointEnvironment.ProxyInstalled("namespaceForProxy", "typeForProxy")); MockApplicationContextProvider.IsProxyCheckerInstalledRetVal = true; Assert.IsFalse(SharePointEnvironment.ProxyInstalled("namespaceForProxy", "typeForProxy")); }
public void WriteSandboxLog_LogsMessage() { //Arrange SharePointEnvironment.Reset(); var context = new SIApplicationContextProvider() { GetCurrentAppDomainFriendlyName = () => "SandboxDomain", IsProxyCheckerInstalled = () => true, IsProxyInstalledStringString = (a, t) => true, }; SharePointEnvironment.ApplicationContextProvider = context; string testMessage = testMessageString; int testEventId = 99; LoggingOperationArgs loggingArgs = null; BSPSite site = new BSPSite(); MSPSite s = new MSPSite(site) { IDGet = () => TestsConstants.TestGuid }; BSPContext.SetCurrent(); MSPContext c = new MSPContext(BSPContext.Current) { SiteGet = () => site }; MSPUtility.ExecuteRegisteredProxyOperationStringStringSPProxyOperationArgs = (a, t, args) => { loggingArgs = args as LoggingOperationArgs; return(null); }; //Act var target = new SharePointLogger(); target.LogToOperations(testMessage, testEventId, SandboxEventSeverity.Error, TestsConstants.AreasCategories); // Assert Assert.IsNotNull(loggingArgs); Assert.AreEqual(loggingArgs.Message, testMessage); Assert.AreEqual(loggingArgs.Category, TestsConstants.AreasCategories); Assert.AreEqual(loggingArgs.EventId, testEventId); Assert.AreEqual((SandboxEventSeverity)loggingArgs.Severity, SandboxEventSeverity.Error); }
public void WriteSandboxTrace_NoContext_TracesMessage() { //Arrange SharePointEnvironment.Reset(); string testMessage = testMessageString; int testEventId = 99; TracingOperationArgs tracingArgs = null; BSPSite site = new BSPSite(); MSPSite s = new MSPSite(site) { IDGet = () => TestsConstants.TestGuid }; MSPContext.CurrentGet = () => null; MSPUtility.ExecuteRegisteredProxyOperationStringStringSPProxyOperationArgs = (a, t, args) => { tracingArgs = args as TracingOperationArgs; return(null); }; var context = new SIApplicationContextProvider() { GetCurrentAppDomainFriendlyName = () => "SandboxDomain", IsProxyCheckerInstalled = () => true, IsProxyInstalledStringString = (a, t) => true, }; SharePointEnvironment.ApplicationContextProvider = context; //Act var target = new SharePointLogger(); target.TraceToDeveloper(testMessage, testEventId, SandboxTraceSeverity.High, TestsConstants.AreasCategories); // Assert Assert.IsNotNull(tracingArgs); Assert.AreEqual(tracingArgs.Message, testMessage); Assert.AreEqual(tracingArgs.Category, TestsConstants.AreasCategories); Assert.AreEqual(tracingArgs.EventId, testEventId); Assert.AreEqual((SandboxTraceSeverity)tracingArgs.Severity, SandboxTraceSeverity.High); }
public void Teardown() { SharePointEnvironment.Reset(); }
public void Cleanup() { SharePointServiceLocator.Reset(); SharePointEnvironment.Reset(); }
public void Teardown() { SharePointServiceLocator.Reset(); SharePointEnvironment.Reset(); }
public void Cleanup() { SharePointEnvironment.Reset(); }