vendredi 15 février 2019

Insert values in class without explicit writing them

I have some huge classes and don't want to write them all out for testing, because it's a huge effort and I could forget some values what makes the test invalid.

Messages = new List<Request.Notif.NotifRuleMessages>
{
    new Request.Notif.NotifRuleMessages
    {
        Code = 1234,
        Message = new List<Request.Notif.NotifRuleMessagesMessage>
        {
            new Request.Notif.NotifMessagesMessage
            {
                Status = new Request.Notif.NotifMessagesMessageStatus
                {
                    Code = 1,
                    Bool = true,
                    Test1 = "Test",
                    Test2 = "Test"
                },
                Rules = new List<Request.Notif.NotifMessagesMessageRule>
                {
                    new Request.Notif.NotifMessagesMessageRule
                    {
                        Lengths = new Request.Notif.NotifMessagesMessageRuleLength
                        {
                            Lenght = 1,
                            Lengths = new List<Request.Notif.NotifMessagesMessageRuleLengthLength>
                            {
                                new Request.Notif.NotifMessagesMessageRuleLengthLength
                                {
                                    Type = "Test",
                                    Value = 1
                                }
                            }
                        },
                        Status = new List<Request.Notif.NotifMessagesMessageRuleStatus>
                        {
                            new Request.Notif.NotifMessagesMessageRuleStatus
                            {
                                Test1 = "Test",
                                Test2 = "Test"


Is there a way to automaticly fill all int values with 1 or 0 and all string values with Test and especially all objects with the right class without unit testing and external libs?

Aucun commentaire:

Enregistrer un commentaire