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


C# Microsoft.VisualStudio.TestTools.UnitTesting.GetType方法代码示例

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


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

示例1: AnonymousTypesTest

        public void AnonymousTypesTest()
        {
            var v = new { Amount = 108, Message = "Hello" };

            // read only!
            // v.Amount = 110;

            Assert.AreEqual("<>f__AnonymousType0`2", v.GetType().Name, "2는 패러매터 숫자를 가리킨다");
            Assert.AreEqual("System.Object", v.GetType().BaseType.FullName, "object 상속");
        }
开发者ID:ohyecloudy,项目名称:csharp-features,代码行数:10,代码来源:AnonymousTypesTests.cs

示例2: ImplicitArrayAssignmentWithSameTypes

        public void ImplicitArrayAssignmentWithSameTypes()
        {
            //Even though we don't specify types explicitly, the compiler
            //will pick one for us
            var names = new[] { "John", "Smith" };
            Assert.AreEqual(typeof(FILL_ME_IN), names.GetType(), "Determine the type of the array elements to improve your Karma.");

            //but only if it can. So this doesn't work
            // (Try uncommenting the line below to see how the compiler reacts)
            //var array = new[] { "John", 1 };
        }
开发者ID:PhotoNomad0,项目名称:csharp-koans,代码行数:11,代码来源:AboutVariables.cs

示例3: GetMemberNames_AnonymousType_ReturnsMemberNamesInOrderDefined

        public void GetMemberNames_AnonymousType_ReturnsMemberNamesInOrderDefined()
        {
            var anonymous = new { prop1 = "value1", prop2 = "value2" };
            var memberNames = FormatterUtils.GetMemberNames(anonymous.GetType());

            Assert.IsNotNull(memberNames);
            Assert.AreEqual(2, memberNames.Count);
            Assert.AreEqual("prop1", memberNames[0]);
            Assert.AreEqual("prop2", memberNames[1]);
        }
开发者ID:jordangray,项目名称:WebApiContrib.Formatting.Xlsx,代码行数:10,代码来源:FormatterUtilsTests.cs

示例4: IsSimpleType_ComplexTypes_ReturnsFalse

        public void IsSimpleType_ComplexTypes_ReturnsFalse()
        {
            var anonymous = new { prop = "val" };

            Assert.IsFalse(FormatterUtils.IsSimpleType(anonymous.GetType()));
            Assert.IsFalse(FormatterUtils.IsSimpleType(typeof(Array)));
            Assert.IsFalse(FormatterUtils.IsSimpleType(typeof(IEnumerable<>)));
            Assert.IsFalse(FormatterUtils.IsSimpleType(typeof(object)));
            Assert.IsFalse(FormatterUtils.IsSimpleType(typeof(SimpleTestItem)));
        }
开发者ID:jordangray,项目名称:WebApiContrib.Formatting.Xlsx,代码行数:10,代码来源:FormatterUtilsTests.cs

示例5: GetEnumerableItemType_ListOfAnonymousObject_ReturnsTestItemType

        public void GetEnumerableItemType_ListOfAnonymousObject_ReturnsTestItemType()
        {
            var anonymous = new { prop1 = "value1", prop2 = "value2" };
            var anonymousList = new[] { anonymous }.ToList();

            var itemType = FormatterUtils.GetEnumerableItemType(anonymousList.GetType());

            Assert.IsNotNull(itemType);
            Assert.AreEqual(anonymous.GetType(), itemType);
        }
开发者ID:jordangray,项目名称:WebApiContrib.Formatting.Xlsx,代码行数:10,代码来源:FormatterUtilsTests.cs

示例6: GetMemberInfo_AnonymousType_ReturnsMemberInfoList

        public void GetMemberInfo_AnonymousType_ReturnsMemberInfoList()
        {
            var anonymous = new { prop1 = "value1", prop2 = "value2" };
            var memberInfo = FormatterUtils.GetMemberInfo(anonymous.GetType());

            Assert.IsNotNull(memberInfo);
            Assert.AreEqual(2, memberInfo.Count);
        }
开发者ID:jordangray,项目名称:WebApiContrib.Formatting.Xlsx,代码行数:8,代码来源:FormatterUtilsTests.cs

示例7: SortAndPaginateKeepsOriginalQueryableType

        public void SortAndPaginateKeepsOriginalQueryableType()
        {
            var readCommand = new ReadCommandInfo
            {
                OrderByProperties = new[] { new OrderByProperty { Property = "Name", Descending = true } },
                Skip = 1,
                Top = 2,
            };

            IQueryable<object> query = new[] { "a", "b", "c", "d" }.AsQueryable().Select(name => new C { Name = name });
            Console.WriteLine(query.GetType());
            Assert.IsTrue(query is IQueryable<C>);

            var result = GenericFilterHelper.SortAndPaginate<object>(query, readCommand);
            Assert.AreEqual("c, b", TestUtility.Dump(result, item => ((C)item).Name));
            Console.WriteLine(result.GetType());
            Assert.IsTrue(result is IQueryable<C>);
        }
开发者ID:davorpr1,项目名称:Rhetos,代码行数:18,代码来源:GenericFilterHelperTest.cs


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