当前位置: 首页>>代码示例>>C#>>正文


C# Mapper.GetOperations方法代码示例

本文整理汇总了C#中Mapper.GetOperations方法的典型用法代码示例。如果您正苦于以下问题:C# Mapper.GetOperations方法的具体用法?C# Mapper.GetOperations怎么用?C# Mapper.GetOperations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mapper的用法示例。


在下文中一共展示了Mapper.GetOperations方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanOverrideReturnType

 public void CanOverrideReturnType()
 {
     var mapper = new Mapper(null);
     var map = typeof(MapTest).GetInterfaceMap(typeof(IMapTest));
     var realReturnType = map.InterfaceMethods.First(m => m.Name == "OverrideReturnTypeTest");
     Assert.IsNotNull(realReturnType);
     Assert.AreEqual(typeof(int), realReturnType.ReturnType);
     var operations = mapper.GetOperations(map, new Stack<Type>());
     var operation = operations.First(o => o.Item1.Equals("/overridereturntype")).Item2;
     Assert.AreEqual("string", operation.type);
 }
开发者ID:mattmhersh,项目名称:WCFRestDemo,代码行数:11,代码来源:MapperTests.cs

示例2: CanSortResponseCodes

        public void CanSortResponseCodes()
        {
            var mapper = new Mapper(null);

            var map = typeof(MapTest).GetInterfaceMap(typeof(IMapTest));
            var operations = mapper.GetOperations(map, new Stack<Type>());

            var operation = operations.First(o => o.Item1.Equals("/keepitsecret")).Item2;

            Assert.AreEqual(7, operation.errorResponses.Count());

            var lastIndex = operation.errorResponses.Count() - 1;
            for (int i = 0; i < lastIndex; i++)
            {
                if (i == (lastIndex - 1))
                    break;
                Assert.IsTrue(operation.errorResponses[i].code < operation.errorResponses[i + 1].code);
            }
        }
开发者ID:mattmhersh,项目名称:WCFRestDemo,代码行数:19,代码来源:MapperTests.cs

示例3: CanMarkOperationSummaryIfTagged

        public void CanMarkOperationSummaryIfTagged()
        {
            var mapper = new Mapper(null, false, true);
            Assert.IsTrue(mapper.MarkTagged);

            var map = typeof(MapTest).GetInterfaceMap(typeof(IMapTest));
            var operations = mapper.GetOperations(map, new Stack<Type>());

            var operation = operations.First(o => o.Item1.Equals("/keepitsecret")).Item2;
            Assert.AreEqual("Secret method***", operation.summary);
        }
开发者ID:mattmhersh,项目名称:WCFRestDemo,代码行数:11,代码来源:MapperTests.cs

示例4: CanOverrideParameterTypeWithDataContractName

 public void CanOverrideParameterTypeWithDataContractName()
 {
     var mapper = new Mapper(null);
     var map = typeof(MapTest).GetInterfaceMap(typeof(IMapTest));
     var testOperations = mapper.GetOperations(map, new Stack<Type>());
     var operation = testOperations.First(o => o.Item1.Equals("/overrideparamtypeascustomtypetest")).Item2;
     Assert.AreEqual(1, operation.parameters.Count);
     Assert.AreEqual("MyRequest", GetTypeFromParamList("req", operation.parameters));
 }
开发者ID:mattmhersh,项目名称:WCFRestDemo,代码行数:9,代码来源:MapperTests.cs

示例5: CanMapResponseCodes

        public void CanMapResponseCodes()
        {
            var mapper = new Mapper(null);

            var map = typeof(MapTest).GetInterfaceMap(typeof(IMapTest));
            var operations = mapper.GetOperations(map, new Stack<Type>());

            var operation = operations.First(o => o.Item1.Equals("/keepitsecret")).Item2;

            Assert.AreEqual(7, operation.errorResponses.Count());
            Assert.AreEqual("OK", operation.errorResponses[0].message);
            Assert.AreEqual(200, operation.errorResponses[0].code);
        }
开发者ID:mattmhersh,项目名称:WCFRestDemo,代码行数:13,代码来源:MapperTests.cs

示例6: CanMapVoidOperation

 public void CanMapVoidOperation()
 {
     var mapper = new Mapper(null);
     var map = typeof (MapTest).GetInterfaceMap(typeof (IMapTest));
     var operations = mapper.GetOperations(map, new Stack<Type>());
     var operation = operations.First(o => o.Item1.Equals("/voidtest")).Item2;
     Assert.IsNotNull(operation);
     Assert.AreEqual("None",operation.type);
 }
开发者ID:mattmhersh,项目名称:WCFRestDemo,代码行数:9,代码来源:MapperTests.cs

示例7: CanMapOperation

        public void CanMapOperation()
        {
            var mapper = new Mapper(new List<string> { "SecretThings" });

            var map = typeof(MapTest).GetInterfaceMap(typeof(IMapTest));
            var operations = mapper.GetOperations(map, new Stack<Type>());

            Assert.AreEqual(6, operations.Count());
            Assert.AreEqual("/method/test", operations.First().Item1);
            var operation = operations.First().Item2;

            Assert.AreEqual(3, operation.parameters.Count);

            var uno = operation.parameters.First(p => p.name.Equals("uno"));
            var dos = operation.parameters.First(p => p.name.Equals("dos"));
            var tres = operation.parameters.First(p => p.name.Equals("tRes"));

            Assert.AreEqual("query", uno.paramType);
            Assert.AreEqual(true, uno.required);
            Assert.IsTrue(string.IsNullOrEmpty(uno.description));

            Assert.AreEqual("query", dos.paramType);
            Assert.AreEqual(true, dos.required);
            Assert.AreEqual("integer(32)", dos.type);

            Assert.AreEqual("query", tres.paramType);
            Assert.AreEqual(false, tres.required);
            Assert.AreEqual("The third option.", tres.description);
            Assert.AreEqual("string(22)", tres.type);
        }
开发者ID:mattmhersh,项目名称:WCFRestDemo,代码行数:30,代码来源:MapperTests.cs

示例8: CanMapOperationUriWithRequiredParams

        public void CanMapOperationUriWithRequiredParams()
        {
            var mapper = new Mapper(new List<string> { "SecretThings" }, true, false);

            Assert.IsTrue(mapper.ShowRequiredQueryParamsInHeader);

            var map = typeof(MapTest).GetInterfaceMap(typeof(IMapTest));
            var operations = mapper.GetOperations(map, new Stack<Type>());

            Assert.AreEqual("/method/test?uno={uno}&dos={dos}", operations.First().Item1);
        }
开发者ID:mattmhersh,项目名称:WCFRestDemo,代码行数:11,代码来源:MapperTests.cs

示例9: CanMapNotesAndSummary

        public void CanMapNotesAndSummary()
        {
            var mapper = new Mapper(null);

            var map = typeof(MapTest).GetInterfaceMap(typeof(IMapTest));
            var operations = mapper.GetOperations(map, new Stack<Type>());
            var operation = operations.First(o => o.Item1.Equals("/method/test")).Item2;

            Assert.AreEqual("Short format", operation.summary);
            Assert.AreEqual("Long format", operation.notes);
        }
开发者ID:mattmhersh,项目名称:WCFRestDemo,代码行数:11,代码来源:MapperTests.cs

示例10: CanMapDataTypeAsDataContractName

 public void CanMapDataTypeAsDataContractName()
 {
     var mapper = new Mapper(null);
     var map = typeof (MapTest).GetInterfaceMap(typeof (IMapTest));
     var testOperations = mapper.GetOperations(map, new Stack<Type>());
     var operation = testOperations.First(o => o.Item1.Equals("/customtypetest")).Item2;
     Assert.AreEqual("MyDataContractName", operation.type);
 }
开发者ID:mattmhersh,项目名称:WCFRestDemo,代码行数:8,代码来源:MapperTests.cs

示例11: CanMapContentTypes

        public void CanMapContentTypes()
        {
            var mapper = new Mapper(null);

            var map = typeof(MapTest).GetInterfaceMap(typeof(IMapTest));
            var operations = mapper.GetOperations(map, new Stack<Type>());

            var operation = operations.First(o => o.Item1.Equals("/keepitsecret")).Item2;
            Assert.AreEqual(1, operation.produces.Count);
            Assert.AreEqual("application/xml", operation.produces[0]);

            var operation2 = operations.First(o => o.Item1.Equals("/method/test")).Item2;
            Assert.AreEqual(2, operation2.produces.Count);
            Assert.IsTrue(operation2.produces.Contains("application/xml"));
            Assert.IsTrue(operation2.produces.Contains("application/json"));
        }
开发者ID:mattmhersh,项目名称:WCFRestDemo,代码行数:16,代码来源:MapperTests.cs

示例12: CanMapBuiltInParams

        public void CanMapBuiltInParams()
        {
            var mapper = new Mapper(null);
            var map = typeof(MapTest).GetInterfaceMap(typeof(IMapTest));
            var operations = mapper.GetOperations(map, new Stack<Type>());
            var operation = operations.First(o => o.Item1.Equals("/voidtest")).Item2;

            Assert.AreEqual(17, operation.parameters.Count);
            Assert.AreEqual("boolean", GetTypeFromParamList("bl", operation.parameters));
            Assert.AreEqual("integer(8)", GetTypeFromParamList("bt", operation.parameters));
            Assert.AreEqual("integer(8, signed)", GetTypeFromParamList("sbt", operation.parameters));
            Assert.AreEqual("character", GetTypeFromParamList("ch", operation.parameters));
            Assert.AreEqual("decimal", GetTypeFromParamList("dm", operation.parameters));
            Assert.AreEqual("double", GetTypeFromParamList("db", operation.parameters));
            Assert.AreEqual("float", GetTypeFromParamList("fl", operation.parameters));
            Assert.AreEqual("integer(32)", GetTypeFromParamList("it", operation.parameters));
            Assert.AreEqual("integer(32, unsigned)", GetTypeFromParamList("uit", operation.parameters));
            Assert.AreEqual("integer(64)", GetTypeFromParamList("lg", operation.parameters));
            Assert.AreEqual("integer(64, unsigned)", GetTypeFromParamList("ulg", operation.parameters));
            Assert.AreEqual("integer(16)", GetTypeFromParamList("st", operation.parameters));
            Assert.AreEqual("integer(16, unsigned)", GetTypeFromParamList("ust", operation.parameters));
            Assert.AreEqual("string", GetTypeFromParamList("str", operation.parameters));
            Assert.AreEqual("Date", GetTypeFromParamList("dt", operation.parameters));
            Assert.AreEqual("string", GetTypeFromParamList("guid", operation.parameters));
            Assert.AreEqual("stream", GetTypeFromParamList("stream", operation.parameters));
        }
开发者ID:mattmhersh,项目名称:WCFRestDemo,代码行数:26,代码来源:MapperTests.cs

示例13: CanHideParameter

 public void CanHideParameter()
 {
     var mapper = new Mapper(null);
     var map = typeof(MapTest).GetInterfaceMap(typeof(IMapTest));
     var operations = mapper.GetOperations(map, new Stack<Type>());
     var operation = operations.First(o => o.Item1.Equals("/hideparamtest")).Item2;
     Assert.AreEqual(1, operation.parameters.Count);
     Assert.AreEqual("foo", operation.parameters[0].name);
     Assert.AreEqual("integer(32)", operation.parameters[0].type);
 }
开发者ID:mattmhersh,项目名称:WCFRestDemo,代码行数:10,代码来源:MapperTests.cs


注:本文中的Mapper.GetOperations方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。