aboutsummaryrefslogtreecommitdiffstats
path: root/tests/Test_Utils/Test_LazyFactory.Helper.cs
blob: f4ae0a00ff066e853fdda703705592fb4027f14e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/***************************************************************************************************
 Copyright (C) 2025 The Qt Company Ltd.
 SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
***************************************************************************************************/

using System.ComponentModel;

namespace Test_Utils
{
    public partial class Test_LazyFactory
    {
        private class Dummy
        {
            public int Prop { get; init; }
        }

        private class NotifyingDummy : INotifyPropertyChanged
        {
            private int prop;
            public int Prop
            {
                get => prop;
                set
                {
                    prop = value;
                    PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Prop)));
                }
            }

            public event PropertyChangedEventHandler? PropertyChanged;
        }

        private class Person
        {
            public int Age { get; init; }
            public string? Name { get; set; }
            public int Score { get; set; }
            public DateTime BirthDate { get; set; }
        }

        private class Address
        {
            public string? City { get; init; }
        }

        private class Customer
        {
            public Address? Address { get; init; }
        }

        private class Order
        {
            public Customer? Customer { get; init; }
        }

        private static class AppSettings
        {
            public static bool IsFeatureEnabled { get; set; }
            public static double Threshold { get; set; }
        }

        private class ValueHolder
        {
            public int Value { get; init; }
        }
        private ValueHolder? valueHolder;

        // Method used in fallback expression
        private ValueHolder? GetHolder() => valueHolder;

        // Helper for method-group init
        private static DateTime FetchReleaseDate() => new(2025, 1, 1);
    }
}