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 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 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")); }
protected virtual void WriteToOperationsLogSandbox(string message, int eventId, SandboxEventSeverity?severity, string category) { if (SharePointLogger.canAccessSandboxLogging == -1) { if (SharePointEnvironment.ProxyInstalled(TracingOperationArgs.OperationAssemblyName, TracingOperationArgs.OperationTypeName)) { SharePointLogger.canAccessSandboxTracing = 1; } else { SharePointLogger.canAccessSandboxTracing = 0; } } if (SharePointLogger.canAccessSandboxTracing == 1) { var args = new LoggingOperationArgs(); args.Message = message; args.EventId = eventId; args.Category = category; args.Severity = (int?)severity; if (SPContext.Current != null) { args.SiteID = SPContext.Current.Site.ID; } else { args.SiteID = null; } var result = SPUtility.ExecuteRegisteredProxyOperation( LoggingOperationArgs.OperationAssemblyName, LoggingOperationArgs.OperationTypeName, args); if (result != null && result.GetType().IsSubclassOf(typeof(System.Exception))) { var ex = new LoggingException(Resources.SandboxLoggingFailed, (Exception)result); throw ex; } } }