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


C# TypeMapper.FromType方法代码示例

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


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

示例1: TransformedType_RequiredProperties_ReturnsRequiredProperties

 public void TransformedType_RequiredProperties_ReturnsRequiredProperties()
 {
     var mapper = new TypeMapper(new CritterPomonaConfiguration());
     var type = mapper.FromType(typeof(Planet));
     var requiredProperties = type.RequiredProperties.ToList();
     Assert.That(requiredProperties.All(x => x.IsRequiredForConstructor), Is.True);
 }
开发者ID:Pomona,项目名称:Pomona,代码行数:7,代码来源:TypeSystemTests.cs

示例2: MatchChildren_FromRootRoute_IsSuccessful

            MatchChildren_FromRootRoute_IsSuccessful()
        {
            // Route might be dependant on parent node, for example: PigTail GetTail(Pig pig)
            // ..or it might not be: PigTail GetTail(int peonId, int animalId) <-- We need to make sure animal is of type Pig before invoking Route
            // WHEN ROUTE IS AMBIGUOUS BY TYPE, WE ALWAYS NEED TO FETCH THE LAST SINGLE-RESOURCE NODE, OR AT LEAST DETERMINE TYPE

            var tm = new TypeMapper(new Config());
            var root = new RootRoute((ResourceType)tm.FromType<Root>());

            var allNodes = root.WrapAsEnumerable<Route>().Flatten(x => x.Children).ToList();

            RouteMatchTree routeMatchTree = new RouteMatchTree(root, "peons/fillifjonka/animals/1234/tail/end",
                                                               Substitute.For<IPomonaSession>());
            routeMatchTree.Leafs.ForEach(Console.WriteLine);
            var match1 = routeMatchTree.Root;
            Assert.That(match1.SelectedFinalMatch, Is.Null);
            var fork = match1.NextFork();
            fork.SelectedChild = fork.Children.First();
            Console.WriteLine(match1.SelectedFinalMatch);

            Console.WriteLine(match1);
        }
开发者ID:Pomona,项目名称:Pomona,代码行数:22,代码来源:RouteTests.cs

示例3: FromEnumType_ReturnsEnumTypeSpec

 public void FromEnumType_ReturnsEnumTypeSpec()
 {
     var mapper = new TypeMapper(new CritterPomonaConfiguration());
     Assert.That(mapper.FromType<CustomEnum>(), Is.InstanceOf<EnumTypeSpec>());
 }
开发者ID:Pomona,项目名称:Pomona,代码行数:5,代码来源:TypeSystemTests.cs


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