本文整理汇总了C#中CodeContractNullability.Test.TestDataBuilders.MemberSourceCodeBuilder类的典型用法代码示例。如果您正苦于以下问题:C# MemberSourceCodeBuilder类的具体用法?C# MemberSourceCodeBuilder怎么用?C# MemberSourceCodeBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MemberSourceCodeBuilder类属于CodeContractNullability.Test.TestDataBuilders命名空间,在下文中一共展示了MemberSourceCodeBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: When_field_type_is_nullable_it_must_be_reported_and_disabled
public void When_field_type_is_nullable_it_must_be_reported_and_disabled()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.InDefaultClass(@"
int? [|f|];
")
.Build();
// Act and assert
VerifyDiagnosticWithFix(source);
}
开发者ID:bkoelman,项目名称:ResharperCodeContractNullability,代码行数:12,代码来源:ReportOnNullableValueTypesSpecs.cs
示例2: When_field_contains_multiple_variables_they_must_be_reported_and_fixed
public void When_field_contains_multiple_variables_they_must_be_reported_and_fixed()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.InDefaultClass(@"
<annotate/> int? [|f|], [|g|];
")
.Build();
// Act and assert
VerifyNullabilityFix(source);
}
示例3: When_async_method_returns_void_it_must_be_skipped
public void When_async_method_returns_void_it_must_be_skipped()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.Using(typeof(Task).Namespace)
.InDefaultClass(@"
async void M() { throw new NotImplementedException(); }
")
.Build();
// Act and assert
VerifyNullabilityDiagnostic(source);
}
示例4: When_field_type_is_nullable_but_analysis_is_disabled_it_must_be_skipped
public void When_field_type_is_nullable_but_analysis_is_disabled_it_must_be_skipped()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.WithSettings(new AnalyzerSettingsBuilder()
.DisableReportOnNullableValueTypes)
.InDefaultClass(@"
int? f;
")
.Build();
// Act and assert
VerifyDiagnosticWithFix(source);
}
开发者ID:bkoelman,项目名称:ResharperCodeContractNullability,代码行数:14,代码来源:ReportOnNullableValueTypesSpecs.cs
示例5: When_lambda_return_value_is_nullable_it_must_be_skipped
public void When_lambda_return_value_is_nullable_it_must_be_skipped()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.InDefaultClass(@"
public void M()
{
Func<int, string> f = p => null;
}
")
.Build();
// Act and assert
VerifyNullabilityDiagnostic(source);
}
示例6: When_property_type_is_generic_task_it_must_be_reported_and_fixed
public void When_property_type_is_generic_task_it_must_be_reported_and_fixed()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.Using(typeof (Task<>).Namespace)
.InDefaultClass(@"
<annotate/> Task<string> [|P|] { get; set; }
")
.Build();
// Act and assert
VerifyNullabilityFix(source);
}
示例7: When_property_item_type_is_object_it_must_be_reported_and_fixed
public void When_property_item_type_is_object_it_must_be_reported_and_fixed()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.Using(typeof (ArrayList).Namespace)
.InDefaultClass(@"
<annotate/> ArrayList [|P|] { get; }
")
.Build();
// Act and assert
VerifyNullabilityFix(source);
}
示例8: When_property_item_type_is_enum_it_must_be_skipped
public void When_property_item_type_is_enum_it_must_be_skipped()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.Using(typeof (IEnumerable<>).Namespace)
.Using(typeof (BindingFlags).Namespace)
.InDefaultClass(@"
IEnumerable<BindingFlags> P { get; set; }
")
.Build();
// Act and assert
VerifyNullabilityDiagnostic(source);
}
示例9: When_property_is_not_debuggable_it_must_be_skipped
public void When_property_is_not_debuggable_it_must_be_skipped()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.Using(typeof (IEnumerable<>).Namespace)
.Using(typeof (DebuggerNonUserCodeAttribute).Namespace)
.InDefaultClass(@"
[DebuggerNonUserCode]
IEnumerable<string> P { get; set; }
")
.Build();
// Act and assert
VerifyNullabilityDiagnostic(source);
}
示例10: When_ref_parameter_is_nullable_it_must_be_reported_and_fixed
public void When_ref_parameter_is_nullable_it_must_be_reported_and_fixed()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.InDefaultClass(@"
void M(<annotate/> ref int? [|p|]) { }
")
.Build();
// Act and assert
VerifyNullabilityFix(source);
}
示例11: When_method_is_compiler_generated_it_must_be_skipped
public void When_method_is_compiler_generated_it_must_be_skipped()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.Using(typeof (CompilerGeneratedAttribute).Namespace)
.InDefaultClass(@"
[CompilerGenerated]
string M() { throw new NotImplementedException(); }
")
.Build();
// Act and assert
VerifyNullabilityDiagnostic(source);
}
示例12: When_indexer_property_type_is_collection_of_reference_type_it_must_be_reported_and_fixed
public void When_indexer_property_type_is_collection_of_reference_type_it_must_be_reported_and_fixed()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.Using(typeof (IEnumerable<>).Namespace)
.InDefaultClass(@"
<annotate/> IEnumerable<int?> [|this|][int p]
{
get { throw new NotImplementedException(); }
set { throw new NotImplementedException(); }
}
")
.Build();
// Act and assert
VerifyNullabilityFix(source);
}
示例13: When_field_type_is_value_type_it_must_be_skipped
public void When_field_type_is_value_type_it_must_be_skipped()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.InDefaultClass(@"
int f;
")
.Build();
// Act and assert
VerifyNullabilityDiagnostic(source);
}
示例14: When_field_type_is_reference_it_must_be_reported_and_fixed
public void When_field_type_is_reference_it_must_be_reported_and_fixed()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.InDefaultClass(@"
<annotate/> string [|f|];
")
.Build();
// Act and assert
VerifyNullabilityFix(source);
}
示例15: When_field_type_is_enum_it_must_be_skipped
public void When_field_type_is_enum_it_must_be_skipped()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.Using(typeof (BindingFlags).Namespace)
.InDefaultClass(@"
BindingFlags f;
")
.Build();
// Act and assert
VerifyNullabilityDiagnostic(source);
}