Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
pshao25 committed Aug 2, 2023
1 parent ece6ad4 commit 14554b1
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@ public class AZC0002Tests
public async Task AZC0002ProducedForMethodsWithoutCancellationTokenOrRequestContext()
{
const string code = @"
using Azure;
using System.Threading.Tasks;
namespace RandomNamespace
{
public class SomeClient
{
public virtual Task {|AZC0002:GetAsync|}()
public virtual Response {|AZC0002:GetAsync|}()
{
return null;
}
public virtual void {|AZC0002:Get|}()
public virtual Response {|AZC0002:Get|}()
{
return null;
}
}
}";
Expand All @@ -38,20 +40,22 @@ await Verifier.CreateAnalyzer(code)
public async Task AZC0002ProducedForMethodsWithWrongNameCancellationToken()
{
const string code = @"
using Azure;
using System.Threading;
using System.Threading.Tasks;
namespace RandomNamespace
{
public class SomeClient
{
public virtual Task {|AZC0002:GetAsync|}(CancellationToken cancellation = default)
public virtual Response {|AZC0002:GetAsync|}(CancellationToken cancellation = default)
{
return null;
}
public virtual void {|AZC0002:Get|}(CancellationToken cancellation = default)
public virtual Response {|AZC0002:Get|}(CancellationToken cancellation = default)
{
return null;
}
}
}";
Expand All @@ -65,20 +69,22 @@ public async Task AZC0002ProducedForMethodsWithWrongNameRequestContext()
{
const string code = @"
using Azure;
using Azure.Core;
using System.Threading;
using System.Threading.Tasks;
namespace RandomNamespace
{
public class SomeClient
{
public virtual Task {|AZC0002:GetAsync|}(RequestContext cancellation = default)
public virtual Response {|AZC0002:GetAsync|}(RequestContext cancellation = default)
{
return null;
}
public virtual void {|AZC0002:Get|}(RequestContext cancellation = default)
public virtual Response {|AZC0002:Get|}(RequestContext cancellation = default)
{
return null;
}
}
}";
Expand All @@ -91,20 +97,22 @@ await Verifier.CreateAnalyzer(code)
public async Task AZC0002ProducedForMethodsWithNonOptionalCancellationToken()
{
const string code = @"
using Azure;
using System.Threading;
using System.Threading.Tasks;
namespace RandomNamespace
{
public class SomeClient
{
public virtual Task {|AZC0002:GetAsync|}(CancellationToken cancellationToken)
public virtual Response {|AZC0002:GetAsync|}(CancellationToken cancellationToken)
{
return null;
}
public virtual void {|AZC0002:Get|}(CancellationToken cancellationToken)
public virtual Response {|AZC0002:Get|}(CancellationToken cancellationToken)
{
return null;
}
}
}";
Expand All @@ -125,13 +133,14 @@ namespace RandomNamespace
{
public class SomeClient
{
public virtual Task {|AZC0002:GetAsync|}(RequestContext context = default, string text = default)
public virtual Response {|AZC0002:GetAsync|}(RequestContext context = default, string text = default)
{
return null;
}
public virtual void {|AZC0002:Get|}(RequestContext context = default, string text = default)
public virtual Response {|AZC0002:Get|}(RequestContext context = default, string text = default)
{
return null;
}
}
}";
Expand All @@ -152,13 +161,14 @@ namespace RandomNamespace
{
public class SomeClient
{
public virtual Task {|AZC0002:GetAsync|}(CancellationToken cancellationToken = default, string text = default)
public virtual Response {|AZC0002:GetAsync|}(CancellationToken cancellationToken = default, string text = default)
{
return null;
}
public virtual void {|AZC0002:Get|}(CancellationToken cancellationToken = default, string text = default)
public virtual Response {|AZC0002:Get|}(CancellationToken cancellationToken = default, string text = default)
{
return null;
}
}
}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,22 @@ public class AZC0003Tests
public async Task AZC0003ProducedForNonVirtualMethods()
{
const string code = @"
using Azure;
using System.Threading;
using System.Threading.Tasks;
namespace RandomNamespace
{
public class SomeClient
{
public Task {|AZC0003:GetAsync|](CancellationToken cancellationToken = default)
public Response {|AZC0003:GetAsync|](CancellationToken cancellationToken = default)
{
return null;
}
public void {|AZC0003:Get|](CancellationToken cancellationToken = default)
public Response {|AZC0003:Get|](CancellationToken cancellationToken = default)
{
return null;
}
}
}";
Expand Down Expand Up @@ -95,4 +97,4 @@ await Verifier.CreateAnalyzer(code)
.RunAsync();
}
}
}
}
Loading

0 comments on commit 14554b1

Please sign in to comment.