コード例 #1
0
        public void ReadableTypeOutputFactory_GetMethodInfo_SomeGenericClass()
        {
            var type    = typeof(SomeGenericClass <string>);
            var members = type.GetMembers(PublicApiHelpers.VisibleMembers).ToList();

            members.Should().NotBeEmpty();

            var methodInfo  = members.OfType <MethodInfo>().Where(c => !c.Name.Contains("_")).FirstOrDefault();
            var eventString = ReadableTypeOutputFactory.GetMethodInfoString(type, methodInfo);

            eventString.Should().BeEquivalentTo("public virtual string ToString()");
        }
コード例 #2
0
        public void ReadableTypeOutputFactory_GetMethodInfo_SomeStaticClass()
        {
            var type    = typeof(SomeStaticClass);
            var members = type.GetMembers(PublicApiHelpers.VisibleMembers).ToList();

            members.Should().NotBeEmpty();

            var methodInfo  = members.OfType <MethodInfo>().Where(c => !c.Name.Contains("_")).FirstOrDefault();
            var eventString = ReadableTypeOutputFactory.GetMethodInfoString(type, methodInfo);

            eventString.Should().BeNullOrWhiteSpace("SomeStaticClass only has private backing fields.");
        }