Exemple #1
0
        public void TestGetInterfaceMethods()
        {
            string methods    = string.Join(",", typeof(ITestInterface).GetMethods().Select(m => m.Name));
            string spsMethods = string.Join(",", ServiceProxySystem.GetProxiedMethods(typeof(ITestInterface)).Select(m => m.Name));

            OutLine(methods);
            Expect.AreEqual(methods, spsMethods);
        }
Exemple #2
0
        public ProxySettingsValidation Validate()
        {
            Args.ThrowIfNull(ServiceType, nameof(ServiceType));
            ProxySettingsValidation result = new ProxySettingsValidation();
            List <MethodInfo>       nonOverridableMethods = new List <MethodInfo>();

            ServiceProxySystem.GetProxiedMethods(ServiceType, IncludeLocalMethods)
            .Where(mi => !mi.IsOverridable())
            .Each(new { NonOverridableMethods = nonOverridableMethods }, (ctx, mi) => ctx.NonOverridableMethods.Add(mi));

            string nonVirtualMethodsMessage = $"Non virtual proxied methods were found; proxies cannot be automatically generated for the specified type {ServiceType.Namespace}.{ServiceType.Name} because proxyable methods were not declared virtual and will subsequently not properly delegate to the remote \"{Host}\"";

            nonVirtualMethodsMessage += $"\r\n\t{string.Join("\r\n\t", nonOverridableMethods.Select(m=> m.Name))}\r\n";
            result.Success            = nonOverridableMethods.Count == 0;
            result.Message            = result.Success ? string.Empty : nonVirtualMethodsMessage;
            result.NonVirtualMethods  = nonOverridableMethods.ToArray();
            return(result);
        }
Exemple #3
0
 public void GetProxiedMethodsShouldHaveResults()
 {
     MethodInfo[] methods = ServiceProxySystem.GetProxiedMethods(typeof(EncryptedEcho));
     Expect.IsGreaterThan(methods.Length, 0, "expected more than zero methods");
 }