Testura/Testura.Code

Is this repo abandoned?

Closed this issue · 23 comments

Just asking because there seems to low to zero activity

No i'm here. I'm not one of the main contributors, that is @MilleBo

I use this library all the time and have written much tools and code for it. Some I have added, but most of the code is in my local libraries that I need to extract and commit to this repo.

No, its not abandoned. What do you need?

@jeffward01 @MilleBo @274188A
I was thinking the same.

For starters, it would probably be good to update NuGet packages as some (notably Roslyn) are a number of versions behind. I'm happy to submit a PR, if that would be accepted?

i was trying to find a way to output a nullable - eg

private string? _foo;

@jeffward01 @MilleBo @274188A I was thinking the same.

For starters, it would probably be good to update NuGet packages as some (notably Roslyn) are a number of versions behind. I'm happy to submit a PR, if that would be accepted?

I think this is a good idea. Im not sure if I have rights to do that, @MilleBo will need to chime in

@jeffward01 @MilleBo @274188A I was thinking the same.

For starters, it would probably be good to update NuGet packages as some (notably Roslyn) are a number of versions behind. I'm happy to submit a PR, if that would be accepted?

If @MilleBo doesn't reply in a few days, maybe we fork the project? I would hate to do that, but I have no way of getting in contact with @MilleBo

@SeanFarrow its a great library, i've looked at all of the other C# code generators, and this one is the easiest to work with. Some improvements that can be made are:

  • only about ~70% of the methods are documented
  • The syntax is a bit strange until you get used to it
  • Im sure theres a few other improvements that we can make that I can't currently think of.

Tbh - this is one of my favorite libraries on github, and i'd love to see it kept active! @MilleBo is the owner, creator, and main developer of it. So i really don't want to fork it.. but if hes not online in the next few days maybe we fork it for now? What do you think @SeanFarrow ?

i was trying to find a way to output a nullable - eg

private string? _foo;

Currently string? is not included in the library. This is due to string is a reference type, and only in C# 8.0 nullability was introduced.

If you try on your compilier var myType = typeof(string?); it will not compile due to this. I know that you can declare private string? _foo; but are not able to instantiate it as nullable. I have to do more research on this tbh.

Here is a list of nullable types you can generate:

https://github.com/Testura/Testura.Code/blob/master/src/Testura.Code.Tests/Generators/Common/TypeGeneratorTests.cs

    [TestCase(typeof(int?), "int?")]
    [TestCase(typeof(double?), "double?")]
    [TestCase(typeof(float?), "float?")]
    [TestCase(typeof(decimal?), "decimal?")]
    [TestCase(typeof(long?), "long?")]
    [TestCase(typeof(uint?), "uint?")]
    [TestCase(typeof(ushort?), "ushort?")]
    [TestCase(typeof(ulong?), "ulong?")]
    [TestCase(typeof(sbyte?), "sbyte?")]
    [TestCase(typeof(byte?), "byte?")]
    [TestCase(typeof(char?), "char?")]
    [TestCase(typeof(bool?), "bool?")]
    [TestCase(typeof(MyCustomEnum?), "MyCustomEnum?")]
    [TestCase(typeof(Guid?), "Guid?")]

Here are two issues which discuss this:
#49

#32

Here is an example of it in action:

Snippet:

   FieldGenerator.Create(
                    new Field(
                        "_fooInt",
                        typeof(int?),
                        new[]
                        {
                            Modifiers.Private
                        }))

Sample Class:

        var classBuilder = new ClassBuilder("Cat", "Models");
        var @class = classBuilder.WithUsings("System")
            .WithConstructor(
                ConstructorGenerator.Create(
                    "Cat",
                    BodyGenerator.Create(
                        Statement.Declaration.Assign("Name", ReferenceGenerator.Create(new VariableReference("name"))),
                        Statement.Declaration.Assign("Age", ReferenceGenerator.Create(new VariableReference("age")))),
                    new List<Parameter>
                    {
                        new("name", typeof(string)),
                        new("age", typeof(int))
                    },
                    new List<Modifiers>
                    {
                        Modifiers.Public
                    }))
            .WithProperties(
                PropertyGenerator.Create(
                    new AutoProperty(
                        "Name",
                        typeof(string),
                        PropertyTypes.GetAndSet,
                        new List<Modifiers>
                        {
                            Modifiers.Public
                        })),
                PropertyGenerator.Create(
                    new AutoProperty(
                        "Age",
                        typeof(int),
                        PropertyTypes.GetAndSet,
                        new List<Modifiers>
                        {
                            Modifiers.Public
                        })))
            .WithFields(
                FieldGenerator.Create(
                    new Field(
                        "_fooInt",
                        typeof(int?),
                        new[]
                        {
                            Modifiers.Private
                        })))
            .Build();

        var codeAsString = new CodeSaver().SaveCodeAsString(@class);

Screenshot:

image

Hope this helps!

I couldn’t agree more. Let’s see what happens by the end of next week. Thanks, Sean. From: Jeff Ward @.> Sent: 18 October 2022 19:09 To: Testura/Testura.Code @.> Cc: Sean Farrow @.>; Mention @.> Subject: Re: [Testura/Testura.Code] Is this repo abandoned? (Issue #91) @jeffward01https://github.com/jeffward01 @MilleBohttps://github.com/MilleBo @274188Ahttps://github.com/274188A I was thinking the same. For starters, it would probably be good to update NuGet packages as some (notably Roslyn) are a number of versions behind. I'm happy to submit a PR, if that would be accepted? If @MilleBohttps://github.com/MilleBo doesn't reply in a few days, maybe we fork the project? I would hate to do that, but I have no way of getting in contact with @MilleBohttps://github.com/MilleBo @SeanFarrowhttps://github.com/SeanFarrow its a great library, i've looked at all of the other C# code generators, and this one is the easiest to work with. Some improvements that can be made are: * only about ~70% of the methods are documented * The syntax is a bit strange until you get used to it * Im sure theres a few other improvements that we can make that I can't currently think of. Tbh - this is one of my favorite libraries on github, and i'd love to see it kept active! @MilleBohttps://github.com/MilleBo is the owner, creator, and main developer of it. So i really don't want to fork it.. but if hes not online in the next few days maybe we fork it for now? What do you think @SeanFarrowhttps://github.com/SeanFarrow ? — Reply to this email directly, view it on GitHub<#91 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AALDK7U5I5RDUAKL24CC6JTWD3RS3ANCNFSM6AAAAAARE5WDQE. You are receiving this because you were mentioned.Message ID: @.***>

I agree, and im pleased your also interested in code generation! Really saves so much time in development and we can build tools to accelerate things.

I built several tools including one that automatically generated EFConfiguration classes for entity framework and such, while @MilleBo has built several tools also, I know a test-generation tool is something he has worked on.

What do you intend to use code generation for? Just curious @SeanFarrow

We will see where this is in a few days and make a fork if needed. I will keep an eye on this!

Thanks again for comment! 🚀

@SeanFarrow - silly me, it appears I do have rights to merge a pull request.

If you create the pull request, i'll merge it.

Sorry for the confusion

Hey guys - sorry for not jumping in earlier and that I not have been working on this project for a while (been a lot of other stuff going on).

But I will have some spare time from now on so if there are any future request or something we should do I'm all up to help with it. I guess the thing with updating all the nuget references could be a good thing to start with.

Ah great!

Hey guys - sorry for not jumping in earlier and that I not have been working on this project for a while (been a lot of other stuff going on).

But I will have some spare time from now on so if there are any future request or something we should do I'm all up to help with it. I guess the thing with updating all the nuget references could be a good thing to start with.

Great to see you again <3 hope your well!

I suspect you saw your inbox blowup with github notifications ahha <3

Hope your other projects are going well!

haha yeah It was hard not to look when I got that many notifications ;-)

A quick question: Some of the tests require .Net framework 4.5.1, based on the fact that a runtime directory is not passed in. What do we want to do about this? Thanks, Sean. From: Mille Boström @.> Sent: 19 October 2022 19:11 To: Testura/Testura.Code @.> Cc: Sean Farrow @.>; Mention @.> Subject: Re: [Testura/Testura.Code] Is this repo abandoned? (Issue #91) haha yeah It was hard not to look when I got that many notifications ;-) — Reply to this email directly, view it on GitHub<#91 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AALDK7UYRQXAJEOQQBTUVFDWEA2T3ANCNFSM6AAAAAARE5WDQE. You are receiving this because you were mentioned.Message ID: @.***>

@MilleBo - is there any reason to continue to support .NET Framework 4.5x? - thats quite old.

If port to netstandard2.0, .NET Framework 4.6.x is supported.

Personally, I just like to build with net6.0 or the upcoming net7.0 - however I believe this breaks all backwards compatibility with .NET Framework

Here is the .NET Standard Compatibility Matrix

There are no real reason to support that old version of .NET framework so if you have to update it just go for it.

According to nuget.org we only support .NET 6 anyway so I think we should just embrace it and try to keep up with the latest version as good as we can.

OK, cool. What about adding default references, currently we add them based on files, should we add them based on types, if yes which types really matter. From: Mille Boström @.> Sent: 20 October 2022 17:58 To: Testura/Testura.Code @.> Cc: Sean Farrow @.>; Mention @.> Subject: Re: [Testura/Testura.Code] Is this repo abandoned? (Issue #91) There are no real reason to support that old version of .NET framework so if you have to update it just go for it. According to nuget.org we only support .NET 6 anyway so I think we should just embrace it and try to keep up with the latest version as good as we can. — Reply to this email directly, view it on GitHub<#91 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AALDK7VT3O6BU6MVYL6XYL3WEF2XXANCNFSM6AAAAAARE5WDQE. You are receiving this because you were mentioned.Message ID: @.***>

I’m not quite sure what you mean by this - references to packages or framework versions?

Can you clarify a bit and give some examples? I don’t quite understand what you mean

I think my main question was what types/assemblies do we want added by default? From: Jeff Ward @.> Sent: 10 November 2022 16:26 To: Testura/Testura.Code @.> Cc: Sean Farrow @.>; Mention @.> Subject: Re: [Testura/Testura.Code] Is this repo abandoned? (Issue #91) OK, cool. What about adding default references, currently we add them based on files, should we add them based on types, if yes which types really matter. From: Mille Boström @.> Sent: 20 October 2022 17:58 To: Testura/Testura.Code @.> Cc: Sean Farrow @.>; Mention @.> Subject: Re: [Testura/Testura.Code] Is this repo abandoned? (Issue #91<#91>) There are no real reason to support that old version of .NET framework so if you have to update it just go for it. According to nuget.org we only support .NET 6 anyway so I think we should just embrace it and try to keep up with the latest version as good as we can. — Reply to this email directly, view it on GitHub<#91 (comment)<#91 (comment)>>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AALDK7VT3O6BU6MVYL6XYL3WEF2XXANCNFSM6AAAAAARE5WDQE. You are receiving this because you were mentioned.Message ID: @.> I’m not quite sure what you mean by this - references to packages or framework versions? Can you clarify a bit and give some examples? I don’t quite understand what you mean — Reply to this email directly, view it on GitHub<#91 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AALDK7WLBTNCS25OXG44YYLWHUO2NANCNFSM6AAAAAARE5WDQE. You are receiving this because you were mentioned.Message ID: @.>

I think just net7.0 standard assemblies - and only necessary nuget packages ( I have to review I’m not sure what is necessary or not)

Do you have any suggestions?