private void AnalyzeServiceAndInterfaces(Type serviceType) { foreach (var interfaceType in ReflectionTools.ExpandInterface(serviceType)) { var interfaceDescription = new InterfaceDescription(interfaceType); string?serviceName = null; if (ServiceContract.IsServiceContractInterface(interfaceType)) { serviceName = ServiceContract.GetServiceName(interfaceType); Services.Add(interfaceDescription); } else { Interfaces.Add(interfaceDescription); } foreach (var method in ReflectionTools.GetMethods(interfaceType)) { string?error; if (serviceName == null || !ServiceContract.IsServiceOperation(method)) { error = "Method {0}.{1}.{2} is not service operation.".FormatWith( ReflectionTools.GetNamespace(interfaceType), interfaceType.Name, method.Name); interfaceDescription.Methods.Add(new MethodDescription(method, error)); continue; } if (TryCreateMessage(method, out var message, out error)) { interfaceDescription.Operations.Add(new OperationDescription( serviceName, ServiceContract.GetServiceOperationName(method), message)); }
public void IsServiceContractInterface(Type serviceType, bool expected) { ServiceContract.IsServiceContractInterface(serviceType).ShouldBe(expected); }