Skip to content

Commit 3b7ae63

Browse files
authored
feature: improve tests so they don't have reliance on the source gene… (#87)
feature: improve tests so they don't have reliance on the source generator already
1 parent 7b0e3f9 commit 3b7ae63

File tree

44 files changed

+349
-190
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+349
-190
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ partial class TestVM
1212
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
1313
private int _test2Property;
1414
/// <inheritdoc cref="_test2PropertyHelper"/>
15-
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator", "1.1.0.0")]
15+
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
1616
private ReactiveUI.ObservableAsPropertyHelper<int>? _test2PropertyHelper;
1717
/// <inheritdoc cref="_test2Property"/>
18-
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator", "1.1.0.0")]
18+
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
1919
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
2020
public int Test2Property { get => _test2Property = _test2PropertyHelper?.Value ?? _test2Property; }
2121

22-
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator", "1.1.0.0")]
22+
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
2323
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
2424
protected void InitializeOAPH()
2525
{
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ namespace TestNs
88
/// <inheritdoc/>
99
partial class TestVM
1010
{
11-
/// <inheritdoc cref="Test4Property"/>
11+
/// <inheritdoc cref="MyNamedProperty"/>
12+
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
13+
private int _myNamedProperty;
14+
/// <inheritdoc cref="_myNamedPropertyHelper"/>
15+
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
16+
private ReactiveUI.ObservableAsPropertyHelper<int>? _myNamedPropertyHelper;
17+
/// <inheritdoc cref="_myNamedProperty"/>
1218
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
13-
private int _test4Property;
14-
/// <inheritdoc cref="_test4PropertyHelper"/>
15-
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator", "1.1.0.0")]
16-
private ReactiveUI.ObservableAsPropertyHelper<int>? _test4PropertyHelper;
17-
/// <inheritdoc cref="_test4Property"/>
18-
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator", "1.1.0.0")]
1919
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
20-
public int Test4Property { get => _test4Property = _test4PropertyHelper?.Value ?? _test4Property; }
20+
public int MyNamedProperty { get => _myNamedProperty = _myNamedPropertyHelper?.Value ?? _myNamedProperty; }
2121

22-
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator", "1.1.0.0")]
22+
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
2323
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
2424
protected void InitializeOAPH()
2525
{
26-
_test4PropertyHelper = Test4!.ToProperty(this, nameof(Test4Property));
26+
_myNamedPropertyHelper = Test3()!.ToProperty(this, nameof(MyNamedProperty));
2727
}
2828
}
2929
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ partial class TestVM
1212
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
1313
private int _test1Property;
1414
/// <inheritdoc cref="_test1PropertyHelper"/>
15-
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator", "1.1.0.0")]
15+
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
1616
private ReactiveUI.ObservableAsPropertyHelper<int>? _test1PropertyHelper;
1717
/// <inheritdoc cref="_test1Property"/>
18-
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator", "1.1.0.0")]
18+
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
1919
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
2020
public int Test1Property { get => _test1Property = _test1PropertyHelper?.Value ?? _test1Property; }
2121

22-
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator", "1.1.0.0")]
22+
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
2323
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
2424
protected void InitializeOAPH()
2525
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//HintName: ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.cs
2+
// Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved.
3+
// Licensed to the .NET Foundation under one or more agreements.
4+
// The .NET Foundation licenses this file to you under the MIT license.
5+
// See the LICENSE file in the project root for full license information.
6+
7+
using System;
8+
9+
// <auto-generated/>
10+
#pragma warning disable
11+
#nullable enable
12+
namespace ReactiveUI.SourceGenerators;
13+
14+
/// <summary>
15+
/// ObservableAsPropertyAttribute.
16+
/// </summary>
17+
/// <seealso cref="Attribute" />
18+
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
19+
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
20+
internal sealed class ObservableAsPropertyAttribute : Attribute
21+
{
22+
/// <summary>
23+
/// Gets the name of the property.
24+
/// </summary>
25+
/// <value>
26+
/// The name of the property.
27+
/// </value>
28+
public string? PropertyName { get; init; }
29+
30+
/// <summary>
31+
/// Gets the Readonly state of the OAPH property.
32+
/// </summary>
33+
/// <value>
34+
/// The is read only of the OAPH property.
35+
/// </value>
36+
public bool ReadOnly { get; init; } = true;
37+
}
38+
#nullable restore
39+
#pragma warning restore
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ namespace TestNs
88
/// <inheritdoc/>
99
partial class TestVM
1010
{
11-
/// <inheritdoc cref="Test3Property"/>
11+
/// <inheritdoc cref="MyNamedProperty"/>
12+
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
13+
private int _myNamedProperty;
14+
/// <inheritdoc cref="_myNamedPropertyHelper"/>
15+
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
16+
private ReactiveUI.ObservableAsPropertyHelper<int>? _myNamedPropertyHelper;
17+
/// <inheritdoc cref="_myNamedProperty"/>
1218
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
13-
private int _test3Property;
14-
/// <inheritdoc cref="_test3PropertyHelper"/>
15-
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator", "1.1.0.0")]
16-
private ReactiveUI.ObservableAsPropertyHelper<int>? _test3PropertyHelper;
17-
/// <inheritdoc cref="_test3Property"/>
18-
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator", "1.1.0.0")]
1919
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
20-
public int Test3Property { get => _test3Property = _test3PropertyHelper?.Value ?? _test3Property; }
20+
public int MyNamedProperty { get => _myNamedProperty = _myNamedPropertyHelper?.Value ?? _myNamedProperty; }
2121

22-
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyFromObservableGenerator", "1.1.0.0")]
22+
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
2323
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
2424
protected void InitializeOAPH()
2525
{
26-
_test3PropertyHelper = Test3()!.ToProperty(this, nameof(Test3Property));
26+
_myNamedPropertyHelper = Test4!.ToProperty(this, nameof(MyNamedProperty));
2727
}
2828
}
2929
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//HintName: ReactiveUI.SourceGenerators.ObservableAsPropertyAttribute.g.cs
2+
// Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved.
3+
// Licensed to the .NET Foundation under one or more agreements.
4+
// The .NET Foundation licenses this file to you under the MIT license.
5+
// See the LICENSE file in the project root for full license information.
6+
7+
using System;
8+
9+
// <auto-generated/>
10+
#pragma warning disable
11+
#nullable enable
12+
namespace ReactiveUI.SourceGenerators;
13+
14+
/// <summary>
15+
/// ObservableAsPropertyAttribute.
16+
/// </summary>
17+
/// <seealso cref="Attribute" />
18+
[global::System.CodeDom.Compiler.GeneratedCode("ReactiveUI.SourceGenerators.ObservableAsPropertyGenerator", "1.1.0.0")]
19+
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
20+
internal sealed class ObservableAsPropertyAttribute : Attribute
21+
{
22+
/// <summary>
23+
/// Gets the name of the property.
24+
/// </summary>
25+
/// <value>
26+
/// The name of the property.
27+
/// </value>
28+
public string? PropertyName { get; init; }
29+
30+
/// <summary>
31+
/// Gets the Readonly state of the OAPH property.
32+
/// </summary>
33+
/// <value>
34+
/// The is read only of the OAPH property.
35+
/// </value>
36+
public bool ReadOnly { get; init; } = true;
37+
}
38+
#nullable restore
39+
#pragma warning restore

0 commit comments

Comments
 (0)