Exemplo n.º 1
0
    public void Get_Friendly_Name()
    {
        TypeName.GetFriendlyName <int>().Should().Be("int");
        TypeName.GetFriendlyName <byte?>().Should().Be("byte?");
        TypeName.GetFriendlyName <DateTime>().Should().Be("DateTime");
        TypeName.GetFriendlyName <Guid?>().Should().Be("Guid?");
        TypeName.GetFriendlyName <TestEnum>().Should().Be("TestEnum");
        TypeName.GetFriendlyName <TestEnum?>().Should().Be("TestEnum?");
        TypeName.GetFriendlyName <Exception>().Should().Be("Exception");

        TypeName.GetFriendlyName <int[]>().Should().Be("int[]");
        TypeName.GetFriendlyName <byte?[]>().Should().Be("byte?[]");
        TypeName.GetFriendlyName <DateTime[]>().Should().Be("DateTime[]");
        TypeName.GetFriendlyName <Guid?[]>().Should().Be("Guid?[]");
        TypeName.GetFriendlyName <TestEnum[]>().Should().Be("TestEnum[]");
        TypeName.GetFriendlyName <TestEnum?[]>().Should().Be("TestEnum?[]");
        TypeName.GetFriendlyName <Exception[]>().Should().Be("Exception[]");

        TypeName.GetFriendlyName <List <int> >().Should().Be("List<int>");
        TypeName.GetFriendlyName <List <byte?> >().Should().Be("List<byte?>");
        TypeName.GetFriendlyName <List <DateTime> >().Should().Be("List<DateTime>");
        TypeName.GetFriendlyName <List <Guid?> >().Should().Be("List<Guid?>");
        TypeName.GetFriendlyName <List <TestEnum> >().Should().Be("List<TestEnum>");
        TypeName.GetFriendlyName <List <TestEnum?> >().Should().Be("List<TestEnum?>");
        TypeName.GetFriendlyName <List <Exception> >().Should().Be("List<Exception>");

        TypeName.GetFriendlyName <Dictionary <string, List <int> > >().Should().Be("Dictionary<string, List<int>>");
        TypeName.GetFriendlyName <Dictionary <string, List <byte?> > >().Should().Be("Dictionary<string, List<byte?>>");
        TypeName.GetFriendlyName <Dictionary <string, List <DateTime> > >().Should().Be("Dictionary<string, List<DateTime>>");
        TypeName.GetFriendlyName <Dictionary <string, List <Guid?> > >().Should().Be("Dictionary<string, List<Guid?>>");
        TypeName.GetFriendlyName <Dictionary <string, List <TestEnum> > >().Should().Be("Dictionary<string, List<TestEnum>>");
        TypeName.GetFriendlyName <Dictionary <string, List <TestEnum?> > >().Should().Be("Dictionary<string, List<TestEnum?>>");
        TypeName.GetFriendlyName <Dictionary <string, List <Exception> > >().Should().Be("Dictionary<string, List<Exception>>");

        TypeName.GetFriendlyName(typeof(object)).Should().Be("object");
        TypeName.GetFriendlyName(typeof(string)).Should().Be("string");
        TypeName.GetFriendlyName(typeof(void)).Should().Be("void");
    }