本文整理汇总了C#中CodeContractNullability.Test.TestDataBuilders.MemberSourceCodeBuilder类的典型用法代码示例。如果您正苦于以下问题:C# MemberSourceCodeBuilder类的具体用法?C# MemberSourceCodeBuilder怎么用?C# MemberSourceCodeBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MemberSourceCodeBuilder类属于CodeContractNullability.Test.TestDataBuilders命名空间,在下文中一共展示了MemberSourceCodeBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:12,代码来源:FieldSpecs.cs
示例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);
}
开发者ID:bkoelman,项目名称:ResharperCodeContractNullability,代码行数:13,代码来源:MethodReturnValueSpecs.cs
示例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);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:15,代码来源:LambdaSpecs.cs
示例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);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:13,代码来源:PropertyCollectionSpecs.cs
示例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);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:13,代码来源:PropertyCollectionSpecs.cs
示例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);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:14,代码来源:PropertyCollectionSpecs.cs
示例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);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:15,代码来源:PropertyCollectionSpecs.cs
示例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);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:12,代码来源:ParameterSpecs.cs
示例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);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:14,代码来源:MethodReturnValueSpecs.cs
示例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);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:17,代码来源:PropertyCollectionSpecs.cs
示例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);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:12,代码来源:FieldSpecs.cs
示例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);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:12,代码来源:FieldSpecs.cs
示例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);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:13,代码来源:FieldSpecs.cs
示例16: When_field_is_event_handler_with_accessors_it_must_be_skipped
public void When_field_is_event_handler_with_accessors_it_must_be_skipped()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.Using(typeof (EventHandler).Namespace)
.InDefaultClass(@"
public event EventHandler E
{
add { throw new NotImplementedException(); }
remove { throw new NotImplementedException(); }
}
")
.Build();
// Act and assert
VerifyNullabilityDiagnostic(source);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:17,代码来源:FieldSpecs.cs
示例17: When_field_is_event_handler_it_must_be_skipped
public void When_field_is_event_handler_it_must_be_skipped()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.Using(typeof (EventHandler).Namespace)
.InDefaultClass(@"
public event EventHandler E;
")
.Build();
// Act and assert
VerifyNullabilityDiagnostic(source);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:13,代码来源:FieldSpecs.cs
示例18: When_field_is_constant_it_must_be_skipped
public void When_field_is_constant_it_must_be_skipped()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.InDefaultClass(@"
public const string F = ""X"";
")
.Build();
// Act and assert
VerifyNullabilityDiagnostic(source);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:12,代码来源:FieldSpecs.cs
示例19: When_ref_parameter_is_value_type_it_must_be_skipped
public void When_ref_parameter_is_value_type_it_must_be_skipped()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.InDefaultClass(@"
void M(ref int p) { }
")
.Build();
// Act and assert
VerifyNullabilityDiagnostic(source);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:12,代码来源:ParameterSpecs.cs
示例20: When_property_type_is_lazy_it_must_be_reported_and_fixed
public void When_property_type_is_lazy_it_must_be_reported_and_fixed()
{
// Arrange
ParsedSourceCode source = new MemberSourceCodeBuilder()
.InDefaultClass(@"
<annotate/> Lazy<string> [|P|] { get; set; }
")
.Build();
// Act and assert
VerifyNullabilityFix(source);
}
开发者ID:imanushin,项目名称:ResharperCodeContractNullability,代码行数:12,代码来源:PropertyCollectionSpecs.cs
注:本文中的CodeContractNullability.Test.TestDataBuilders.MemberSourceCodeBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论