public void Execute_ReturnsArgumentNullException_WhenTypeNameIsNull() { var proxyOp = new ProxyInstalledOperation(); var args = new ProxyInstalledArgs(); args.AssemblyName = ProxyInstalledArgs.OperationAssemblyName; args.TypeName = null; //Act object result = proxyOp.Execute(args); //Assert Assert.IsInstanceOfType(result, typeof(ArgumentNullException)); }
public bool IsProxyInstalled(string assemblyName, string typeForProxy) { var args = new ProxyInstalledArgs(); args.AssemblyName = assemblyName; args.TypeName = typeForProxy; var result = ExecuteRegisteredProxyOperation( ProxyInstalledArgs.OperationAssemblyName, ProxyInstalledArgs.OperationTypeName, args); if (result != null && result.GetType().IsSubclassOf(typeof(System.Exception))) { var configException = new ConfigurationException(Resources.FailureReadingProxyInstalled, (Exception)result); throw configException; } return((bool)result); }
public bool IsProxyCheckerInstalled() { if (CheckInGAC() == false) { return(false); } var args = new ProxyInstalledArgs() { AssemblyName = ProxyInstalledArgs.OperationAssemblyName, TypeName = ProxyInstalledArgs.OperationTypeName }; try { var result = ExecuteRegisteredProxyOperation( ProxyInstalledArgs.OperationAssemblyName, ProxyInstalledArgs.OperationTypeName, args); } catch (ArgumentException) { // this will occur if the proxy args are not in a gac'd assembly (i.e., if the Microsoft.Practices.SharePoint.Common // assembly is not gac'd). return(false); } catch (TypeLoadException) { //this will occur if the operation is not deployed to the gac return(false); } catch (InvalidOperationException) { // this will occur if the operation isn't available. return(false); } return(true); }
public void Execute_ReturnsTrue_WhenProxyExists() { var args = new ProxyInstalledArgs(); var opsList = new List <SPProxyOperationType>(); opsList.Add(new SPProxyOperationType(ReadConfigArgs.OperationAssemblyName, ReadConfigArgs.OperationTypeName)); opsList.Add(new SPProxyOperationType(ContainsKeyDataArgs.OperationAssemblyName, ContainsKeyDataArgs.OperationTypeName)); opsList.Add(new SPProxyOperationType(LoggingOperationArgs.OperationAssemblyName, LoggingOperationArgs.OperationTypeName)); var userService = new MSPUserCodeService(); userService.ProxyOperationTypesGet = () => opsList; MSPUserCodeService.LocalGet = () => userService; args.AssemblyName = LoggingOperationArgs.OperationAssemblyName; args.TypeName = LoggingOperationArgs.OperationTypeName; var proxyOp = new ProxyInstalledOperation(); //Act var result = proxyOp.Execute(args); //Assert Assert.IsInstanceOfType(result, typeof(bool)); Assert.IsTrue((bool)result); }