コード例 #1
0
        public void GetSafeTypeName_BuiltinTypeGiven_ShouldReturnShortenRepresentation()
        {
            var type = typeof(int);

            var result = CSharpSourceCodeGeneration.GetSafeTypeName(type);

            result.Should().Be("int");
        }
コード例 #2
0
        public void GetSafeTypeName_ArrayGiven_ShouldReturnArrayType()
        {
            var type = typeof(SampleClass[]);

            var result = CSharpSourceCodeGeneration.GetSafeTypeName(type);

            result.Should().Be("SampleClass[]");
        }
コード例 #3
0
        public void GetSafeTypeName_GenericGiven_ShouldReturnCorrespondingGenericExpression()
        {
            var type = typeof(Action <SampleStruct>);

            var result = CSharpSourceCodeGeneration.GetSafeTypeName(type);

            result.Should().Be("Action<SampleStruct>");
        }
コード例 #4
0
        public void GetSafeTypeName_ClassGiven_ShouldReturnClassName()
        {
            var type = typeof(SampleClass);

            var result = CSharpSourceCodeGeneration.GetSafeTypeName(type);

            result.Should().Be(type.Name);
        }