1
+ // Copyright (c) 2019-2022 ReactiveUI Association Incorporated. All rights reserved.
2
+ // ReactiveUI Association Incorporated licenses this file to you under the MIT license.
3
+ // See the LICENSE file in the project root for full license information.
4
+
1
5
using System . Collections . Generic ;
2
6
using System . Linq ;
3
7
using System . Reactive . Linq ;
4
8
using System . Runtime . Serialization ;
9
+
5
10
using DynamicData . Binding ;
11
+
6
12
using ReactiveUI ;
7
13
8
- namespace ReactiveMarbles . Mvvm . Benchmarks . Memory
14
+ namespace ReactiveMarbles . Mvvm . Benchmarks . Memory ;
15
+
16
+ /// <summary>
17
+ /// Dummy object for the reactive object for tests.
18
+ /// </summary>
19
+ public class DummyReactiveObject : ReactiveObject
9
20
{
10
- public class DummyReactiveObject : ReactiveObject
21
+ private readonly ObservableAsPropertyHelper < string > _observableProperty ;
22
+
23
+ [ IgnoreDataMember ]
24
+ private string ? _isNotNullString ;
25
+
26
+ [ IgnoreDataMember ]
27
+ private string ? _isOnlyOneWord ;
28
+
29
+ private string ? _notSerialized ;
30
+
31
+ [ IgnoreDataMember ]
32
+ private int ? _nullableInt ;
33
+
34
+ [ IgnoreDataMember ]
35
+ private string ? _pocoProperty ;
36
+
37
+ [ IgnoreDataMember ]
38
+ private List < string > ? _stackOverflowTrigger ;
39
+
40
+ [ IgnoreDataMember ]
41
+ private string ? _usesExprRaiseSet ;
42
+
43
+ /// <summary>
44
+ /// Initializes a new instance of the <see cref="DummyReactiveObject"/> class.
45
+ /// </summary>
46
+ public DummyReactiveObject ( )
47
+ {
48
+ TestCollection = new ObservableCollectionExtended < int > ( ) ;
49
+ _observableProperty =
50
+ this . WhenAnyValue ( x => x . IsOnlyOneWord )
51
+ . Select ( x => x + "Changed" )
52
+ . ToProperty ( this , nameof ( ObservableProperty ) ) ;
53
+ }
54
+
55
+ /// <summary>
56
+ /// Gets or sets the is not null string.
57
+ /// </summary>
58
+ [ DataMember ]
59
+ public string ? IsNotNullString
60
+ {
61
+ get => _isNotNullString ;
62
+ set => this . RaiseAndSetIfChanged ( ref _isNotNullString , value ) ;
63
+ }
64
+
65
+ /// <summary>
66
+ /// Gets or sets the is only one word.
67
+ /// </summary>
68
+ [ DataMember ]
69
+ public string ? IsOnlyOneWord
11
70
{
12
- [ IgnoreDataMember ]
13
- private string ? _isNotNullString ;
14
-
15
- [ IgnoreDataMember ]
16
- private string ? _isOnlyOneWord ;
17
-
18
- private string ? _notSerialized ;
19
-
20
- [ IgnoreDataMember ]
21
- private int ? _nullableInt ;
22
-
23
- [ IgnoreDataMember ]
24
- private string ? _pocoProperty ;
25
-
26
- [ IgnoreDataMember ]
27
- private List < string > ? _stackOverflowTrigger ;
28
-
29
- [ IgnoreDataMember ]
30
- private string ? _usesExprRaiseSet ;
31
-
32
- private ObservableAsPropertyHelper < string > _observableProperty ;
33
-
34
- /// <summary>
35
- /// Initializes a new instance of the <see cref="TestFixture"/> class.
36
- /// </summary>
37
- public DummyReactiveObject ( )
38
- {
39
- TestCollection = new ObservableCollectionExtended < int > ( ) ;
40
- _observableProperty =
41
- this . WhenAnyValue ( x => x . IsOnlyOneWord )
42
- . Select ( x => x + "Changed" )
43
- . ToProperty ( this , nameof ( ObservableProperty ) ) ;
44
- }
45
-
46
- /// <summary>
47
- /// Gets or sets the is not null string.
48
- /// </summary>
49
- [ DataMember ]
50
- public string ? IsNotNullString
51
- {
52
- get => _isNotNullString ;
53
- set => this . RaiseAndSetIfChanged ( ref _isNotNullString , value ) ;
54
- }
55
-
56
- /// <summary>
57
- /// Gets or sets the is only one word.
58
- /// </summary>
59
- [ DataMember ]
60
- public string ? IsOnlyOneWord
61
- {
62
- get => _isOnlyOneWord ;
63
- set => this . RaiseAndSetIfChanged ( ref _isOnlyOneWord , value ) ;
64
- }
65
-
66
- /// <summary>
67
- /// Gets or sets the not serialized.
68
- /// </summary>
69
- public string ? NotSerialized
70
- {
71
- get => _notSerialized ;
72
- set => this . RaiseAndSetIfChanged ( ref _notSerialized , value ) ;
73
- }
74
-
75
- /// <summary>
76
- /// Gets or sets the nullable int.
77
- /// </summary>
78
- [ DataMember ]
79
- public int ? NullableInt
80
- {
81
- get => _nullableInt ;
82
- set => this . RaiseAndSetIfChanged ( ref _nullableInt , value ) ;
83
- }
84
-
85
- /// <summary>
86
- /// Gets or sets the poco property.
87
- /// </summary>
88
- [ DataMember ]
89
- public string ? PocoProperty
90
- {
91
- get => _pocoProperty ;
92
- set => _pocoProperty = value ;
93
- }
94
-
95
- /// <summary>
96
- /// Gets or sets the stack overflow trigger.
97
- /// </summary>
98
- [ DataMember ]
99
- public List < string > ? StackOverflowTrigger
100
- {
101
- get => _stackOverflowTrigger ;
102
- set => this . RaiseAndSetIfChanged ( ref _stackOverflowTrigger , value ? . ToList ( ) ) ;
103
- }
104
-
105
- /// <summary>
106
- /// Gets or sets the test collection.
107
- /// </summary>
108
- [ DataMember ]
109
- public ObservableCollectionExtended < int > TestCollection { get ; protected set ; }
110
-
111
- /// <summary>
112
- /// Gets or sets the uses expr raise set.
113
- /// </summary>
114
- [ DataMember ]
115
- public string ? UsesExprRaiseSet
116
- {
117
- get => _usesExprRaiseSet ;
118
- set => this . RaiseAndSetIfChanged ( ref _usesExprRaiseSet , value ) ;
119
- }
120
-
121
- /// <summary>
122
- /// Gets the observable property.
123
- /// </summary>
124
- public string ObservableProperty => _observableProperty . Value ;
71
+ get => _isOnlyOneWord ;
72
+ set => this . RaiseAndSetIfChanged ( ref _isOnlyOneWord , value ) ;
125
73
}
74
+
75
+ /// <summary>
76
+ /// Gets or sets the not serialized.
77
+ /// </summary>
78
+ public string ? NotSerialized
79
+ {
80
+ get => _notSerialized ;
81
+ set => this . RaiseAndSetIfChanged ( ref _notSerialized , value ) ;
82
+ }
83
+
84
+ /// <summary>
85
+ /// Gets or sets the nullable int.
86
+ /// </summary>
87
+ [ DataMember ]
88
+ public int ? NullableInt
89
+ {
90
+ get => _nullableInt ;
91
+ set => this . RaiseAndSetIfChanged ( ref _nullableInt , value ) ;
92
+ }
93
+
94
+ /// <summary>
95
+ /// Gets or sets the poco property.
96
+ /// </summary>
97
+ [ DataMember ]
98
+ public string ? PocoProperty
99
+ {
100
+ get => _pocoProperty ;
101
+ set => _pocoProperty = value ;
102
+ }
103
+
104
+ /// <summary>
105
+ /// Gets or sets the stack overflow trigger.
106
+ /// </summary>
107
+ [ DataMember ]
108
+ public List < string > ? StackOverflowTrigger
109
+ {
110
+ get => _stackOverflowTrigger ;
111
+ set => this . RaiseAndSetIfChanged ( ref _stackOverflowTrigger , value ? . ToList ( ) ) ;
112
+ }
113
+
114
+ /// <summary>
115
+ /// Gets or sets the test collection.
116
+ /// </summary>
117
+ [ DataMember ]
118
+ public ObservableCollectionExtended < int > TestCollection { get ; protected set ; }
119
+
120
+ /// <summary>
121
+ /// Gets or sets the uses expr raise set.
122
+ /// </summary>
123
+ [ DataMember ]
124
+ public string ? UsesExprRaiseSet
125
+ {
126
+ get => _usesExprRaiseSet ;
127
+ set => this . RaiseAndSetIfChanged ( ref _usesExprRaiseSet , value ) ;
128
+ }
129
+
130
+ /// <summary>
131
+ /// Gets the observable property.
132
+ /// </summary>
133
+ public string ObservableProperty => _observableProperty . Value ;
126
134
}
0 commit comments