-
Notifications
You must be signed in to change notification settings - Fork 493
Expand file tree
/
Copy pathBaseBindablePropertyAttributeSourceGeneratorTest.cs
More file actions
37 lines (32 loc) · 1.76 KB
/
BaseBindablePropertyAttributeSourceGeneratorTest.cs
File metadata and controls
37 lines (32 loc) · 1.76 KB
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
namespace CommunityToolkit.Maui.SourceGenerators.Internal.UnitTests.BindablePropertyAttributeSourceGeneratorTests;
public class BaseBindablePropertyAttributeSourceGeneratorTest : BaseTest
{
protected const string defaultTestClassName = "TestView";
protected const string defaultTestNamespace = "TestNamespace";
protected const string expectedAttribute =
/* language=C#-test */
//lang=csharp
$$"""
// <auto-generated>
// See: CommunityToolkit.Maui.SourceGenerators.Internal.BindablePropertyAttributeSourceGenerator
#pragma warning disable
#nullable enable
namespace CommunityToolkit.Maui;
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.AttributeUsage(global::System.AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
[global::System.Diagnostics.CodeAnalysis.Experimental("{{BindablePropertyAttributeSourceGenerator.BindablePropertyAttributeExperimentalDiagnosticId}}")]
sealed partial class BindablePropertyAttribute : global::System.Attribute
{
public string? PropertyName { get; }
public global::System.Type? DeclaringType { get; set; }
public global::Microsoft.Maui.Controls.BindingMode DefaultBindingMode { get; set; }
public string ValidateValueMethodName { get; set; } = string.Empty;
public string PropertyChangedMethodName { get; set; } = string.Empty;
public string PropertyChangingMethodName { get; set; } = string.Empty;
public string CoerceValueMethodName { get; set; } = string.Empty;
public string DefaultValueCreatorMethodName { get; set; } = string.Empty;
}
""";
protected static Task VerifySourceGeneratorAsync(string source, string expectedGenerated) =>
VerifySourceGeneratorAsync(source, expectedAttribute, ($"{defaultTestClassName}.g.cs", expectedGenerated));
}