Dreamine.FullKit.Tests 1.0.0.0
Dreamine.FullKit.Tests 기능을 검증하는 자동화 테스트 프로젝트입니다.
로딩중...
검색중...
일치하는것 없음
Dreamine.FullKit.Tests.Generators.SourceGeneratorTests 클래스 참조sealed

더 자세히 ...

Public 멤버 함수

void DreamineCommandSourceGenerator_GeneratesSimpleCommandPropertyForPartialViewModel ()
void DreamineCommandSourceGenerator_GeneratesForwardingMethodForPartialDeclaration ()
void DreamineCommandSourceGenerator_ReportsDiagnosticForNonPartialType ()
void DreamineAutoWiringGenerator_GeneratesPropertyForDreaminePropertyField ()

정적 Private 멤버 함수

static GeneratorRunResult RunGenerator (string source, IIncrementalGenerator generator)
static IEnumerable< MetadataReference > GetReferences ()

상세한 설명

Source Generator Tests 기능과 관련 상태를 캡슐화합니다.

SourceGeneratorTests.cs 파일의 16 번째 라인에서 정의되었습니다.

멤버 함수 문서화

◆ DreamineAutoWiringGenerator_GeneratesPropertyForDreaminePropertyField()

void Dreamine.FullKit.Tests.Generators.SourceGeneratorTests.DreamineAutoWiringGenerator_GeneratesPropertyForDreaminePropertyField ( )
inline

Dreamine Auto Wiring Generator Generates Property For Dreamine Property Field 작업을 수행합니다.

SourceGeneratorTests.cs 파일의 127 번째 라인에서 정의되었습니다.

128 {
129 var source = """
130 using Dreamine.MVVM.Attributes;
131
132 namespace Sample;
133
134 public partial class MainViewModel
135 {
136 [DreamineProperty]
137 private string _title = "";
138
139 protected bool SetProperty<T>(ref T field, T value)
140 {
141 field = value;
142 return true;
143 }
144 }
145 """;
146
147 var runResult = RunGenerator(source, new DreamineAutoWiringGenerator());
148
149 var generated = Assert.Single(runResult.GeneratedSources);
150 Assert.Contains("public string Title", generated.SourceText.ToString());
151 }

다음을 참조함 : RunGenerator().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ DreamineCommandSourceGenerator_GeneratesForwardingMethodForPartialDeclaration()

void Dreamine.FullKit.Tests.Generators.SourceGeneratorTests.DreamineCommandSourceGenerator_GeneratesForwardingMethodForPartialDeclaration ( )
inline

Dreamine Command Source Generator Generates Forwarding Method For Partial Declaration 작업을 수행합니다.

SourceGeneratorTests.cs 파일의 61 번째 라인에서 정의되었습니다.

62 {
63 var source = """
64 using Dreamine.MVVM.Attributes;
65
66 namespace Sample;
67
68 public partial class MainViewModel
69 {
70 private string? Result { get; set; }
71
72 private string Load() => "Loaded";
73
74 [DreamineCommand("Load", BindTo = "Result")]
75 private partial void LoadResult();
76 }
77 """;
78
79 var runResult = RunGenerator(source, new DreamineCommandSourceGenerator());
80
81 var generated = Assert.Single(runResult.GeneratedSources);
82 var text = generated.SourceText.ToString();
83 Assert.Contains("LoadResultCommand", text);
84 Assert.Contains("var __result = Load();", text);
85 Assert.Contains("Result = __result;", text);
86 }

다음을 참조함 : RunGenerator().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ DreamineCommandSourceGenerator_GeneratesSimpleCommandPropertyForPartialViewModel()

void Dreamine.FullKit.Tests.Generators.SourceGeneratorTests.DreamineCommandSourceGenerator_GeneratesSimpleCommandPropertyForPartialViewModel ( )
inline

Dreamine Command Source Generator Generates Simple Command Property For Partial View Model 작업을 수행합니다.

SourceGeneratorTests.cs 파일의 27 번째 라인에서 정의되었습니다.

28 {
29 var source = """
30 using Dreamine.MVVM.Attributes;
31
32 namespace Sample;
33
34 public partial class MainViewModel
35 {
36 [DreamineCommand]
37 private void Save()
38 {
39 }
40 }
41 """;
42
43 var runResult = RunGenerator(source, new DreamineCommandSourceGenerator());
44
45 var generated = Assert.Single(runResult.GeneratedSources);
46 var text = generated.SourceText.ToString();
47 Assert.Contains("SaveCommand", text);
48 Assert.Contains("ICommand", text);
49 Assert.Contains("new __DreamineGeneratedCommand_Save(Save)", text);
50 }

다음을 참조함 : RunGenerator().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ DreamineCommandSourceGenerator_ReportsDiagnosticForNonPartialType()

void Dreamine.FullKit.Tests.Generators.SourceGeneratorTests.DreamineCommandSourceGenerator_ReportsDiagnosticForNonPartialType ( )
inline

Dreamine Command Source Generator Reports Diagnostic For Non Partial Type 작업을 수행합니다.

SourceGeneratorTests.cs 파일의 97 번째 라인에서 정의되었습니다.

98 {
99 var source = """
100 using Dreamine.MVVM.Attributes;
101
102 namespace Sample;
103
104 public class MainViewModel
105 {
106 [DreamineCommand]
107 private void Save()
108 {
109 }
110 }
111 """;
112
113 var runResult = RunGenerator(source, new DreamineCommandSourceGenerator());
114
115 Assert.Contains(runResult.Diagnostics, diagnostic => diagnostic.Id == "DMCMD002");
116 }

다음을 참조함 : RunGenerator().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ GetReferences()

IEnumerable< MetadataReference > Dreamine.FullKit.Tests.Generators.SourceGeneratorTests.GetReferences ( )
inlinestaticprivate

References 값을 가져옵니다.

반환값
Get References 작업에서 생성한 IEnumerable<MetadataReference> 결과입니다.

SourceGeneratorTests.cs 파일의 215 번째 라인에서 정의되었습니다.

216 {
217 var trustedPlatformAssemblies = ((string?)AppContext.GetData("TRUSTED_PLATFORM_ASSEMBLIES"))
218 ?.Split(Path.PathSeparator)
219 ?? Array.Empty<string>();
220
221 return trustedPlatformAssemblies
222 .Concat(new[] { typeof(DreamineCommandAttribute).Assembly.Location })
223 .Distinct(StringComparer.OrdinalIgnoreCase)
224 .Select(path => MetadataReference.CreateFromFile(path));
225 }

다음에 의해서 참조됨 : RunGenerator().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ RunGenerator()

GeneratorRunResult Dreamine.FullKit.Tests.Generators.SourceGeneratorTests.RunGenerator ( string source,
IIncrementalGenerator generator )
inlinestaticprivate

Run Generator 작업을 수행합니다.

매개변수
sourcesource에 사용할 string 값입니다.
generatorgenerator에 사용할 IIncrementalGenerator 값입니다.
반환값
Run Generator 작업에서 생성한 GeneratorRunResult 결과입니다.

SourceGeneratorTests.cs 파일의 185 번째 라인에서 정의되었습니다.

186 {
187 var compilation = CSharpCompilation.Create(
188 "GeneratorTests",
189 new[] { CSharpSyntaxTree.ParseText(source) },
190 GetReferences(),
191 new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary));
192
193 var driver = CSharpGeneratorDriver.Create(generator);
194 driver = (CSharpGeneratorDriver)driver.RunGeneratorsAndUpdateCompilation(compilation, out _, out _);
195
196 return driver.GetRunResult().Results.Single();
197 }

다음을 참조함 : GetReferences().

다음에 의해서 참조됨 : DreamineAutoWiringGenerator_GeneratesPropertyForDreaminePropertyField(), DreamineCommandSourceGenerator_GeneratesForwardingMethodForPartialDeclaration(), DreamineCommandSourceGenerator_GeneratesSimpleCommandPropertyForPartialViewModel(), DreamineCommandSourceGenerator_ReportsDiagnosticForNonPartialType().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: