コード例 #1
0
        public void NullServiceContractGeneratesServiceContract()
        {
            ProjectMappingManagerSetup.InitializeManager(ServiceProvider, "ProjectMapping.ServiceContractDsl.Tests.xml");

            Service rootElement = CreateDefaultService();

            rootElement.Namespace = ServiceNamespace;
            AsmxService extender = new AsmxService();

            extender.ModelElement       = rootElement;
            rootElement.ObjectExtender  = extender;
            rootElement.ServiceContract = null;

            string content = RunTemplate(rootElement);

            Type generatedType = CompileAndGetType(content);

            TypeAsserter.AssertInterface(ServiceContractInterfaceName, generatedType, 0);
        }
コード例 #2
0
        public void TestOperationWithoutResponse()
        {
            ProjectMappingManagerSetup.InitializeManager(ServiceProvider, "ProjectMapping.ServiceContractDsl.Tests.xml");

            Service rootElement = CreateDefaultService();

            rootElement.ServiceContract = CreateServiceContract(rootElement.ServiceContractModel, ServiceContractName, OperationName, RequestName, null);
            string content = RunTemplate(rootElement);

            EnsureType(ref content, ServiceContractInterfaceName);
            EnsureType(ref content, RequestName);
            string implementationContent = this.GetImplementationContent(ImplementationKind.Request);
            Type   generatedType         = CompileAndGetType(content + implementationContent);

            TypeAsserter.AssertInterface(GetFullServiceContractInterfaceName(), generatedType);
            MethodInfo method = TypeAsserter.AssertMethod(OperationName, generatedType);

            Assert.AreEqual <string>(RequestName, ((ParameterInfo)method.GetParameters().GetValue(0)).ParameterType.Name);
            Assert.AreEqual <string>("Void", method.ReturnType.Name);
        }