Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested embedded properties does not support validation rules #1146

Closed
rmadsen-ks opened this issue Jun 8, 2023 · 2 comments · Fixed by #1147
Closed

Nested embedded properties does not support validation rules #1146

rmadsen-ks opened this issue Jun 8, 2023 · 2 comments · Fixed by #1147
Assignees
Labels
bug Something isn't working
Milestone

Comments

@rmadsen-ks
Copy link
Collaborator

Nested embedded properties generally works, but validation rules does not work.

See for example:

namespace ExamplePLugin
{
    [Display("Embedded Properties Issue")]
    public class EmbeddedPropertiesDebug:TestStep
    {
        [EmbedProperties]
        public ParmObj1 Obj1 { get; set; } =  new ParmObj1();
        public override void Run()
        {
            throw new NotImplementedException();
        }
    }


    public class ParmObj1: ValidatingObject
    {
        public int MyValue { get; set;}


        [EmbedProperties]
        public ParmObj2 obj2 { get; set; } = new ParmObj2();

        public bool CheckValue()
        {
            return MyValue > 0 && MyValue < 100;
        }
        public ParmObj1()
        {
            Rules.Add(CheckValue, "MyValue must be in range 0 to 100", nameof(MyValue));
        }
    }

    public class ParmObj2: ValidatingObject
    {
        public int MyValue { get; set; }
        public bool CheckValue()
        {
            return MyValue > 0 && MyValue < 100;
        }
        public ParmObj2()
        {
            Rules.Add(CheckValue, "MyValue must be in range 0 to 100", nameof(MyValue));
        }
    }
}

 [Display("Embedded Properties Issue")]
    public class EmbeddedPropertiesDebug:TestStep
    {
        [EmbedProperties]
        public ParmObj1 Obj1 { get; set; } =  new ParmObj1();
        public override void Run()
        {
            throw new NotImplementedException();
        }
    }
@rmadsen-ks rmadsen-ks added the bug Something isn't working label Jun 8, 2023
@rmadsen-ks rmadsen-ks self-assigned this Jun 8, 2023
@alnlarsen alnlarsen linked a pull request Jun 8, 2023 that will close this issue
@alnlarsen alnlarsen added this to the 9.21.1 milestone Jun 8, 2023
@github-actions
Copy link

A fix for this is in OpenTAP version 9.21.1-beta.9+8cd63c25 or later.

@alnlarsen alnlarsen modified the milestones: 9.21.1, 9.22.0 Jun 27, 2023
@sebastian-pop
Copy link
Collaborator

The initial issue is confirmed on OpenTAP 9.21.1

Fix confirmed on OpenTAP 9.22.0-rc.1

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants