mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
docs(dotnet): use modern namespace syntax for api testing snippets (#17271)
This commit is contained in:
parent
c7367b7065
commit
ab4876242f
@ -39,11 +39,10 @@ using Microsoft.Playwright.NUnit;
|
|||||||
using Microsoft.Playwright;
|
using Microsoft.Playwright;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace PlaywrightTests
|
namespace PlaywrightTests;
|
||||||
{
|
|
||||||
|
|
||||||
public class TestGitHubAPI : PlaywrightTest
|
public class TestGitHubAPI : PlaywrightTest
|
||||||
{
|
{
|
||||||
static string API_TOKEN = Environment.GetEnvironmentVariable("GITHUB_API_TOKEN");
|
static string API_TOKEN = Environment.GetEnvironmentVariable("GITHUB_API_TOKEN");
|
||||||
|
|
||||||
private IAPIRequestContext Request = null;
|
private IAPIRequestContext Request = null;
|
||||||
@ -75,7 +74,6 @@ namespace PlaywrightTests
|
|||||||
{
|
{
|
||||||
await Request.DisposeAsync();
|
await Request.DisposeAsync();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -91,12 +89,11 @@ using Microsoft.Playwright.NUnit;
|
|||||||
using Microsoft.Playwright;
|
using Microsoft.Playwright;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace PlaywrightTests
|
namespace PlaywrightTests;
|
||||||
{
|
|
||||||
|
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestGitHubAPI : PlaywrightTest
|
public class TestGitHubAPI : PlaywrightTest
|
||||||
{
|
{
|
||||||
static string REPO = "test-repo-2";
|
static string REPO = "test-repo-2";
|
||||||
static string USER = Environment.GetEnvironmentVariable("GITHUB_USER");
|
static string USER = Environment.GetEnvironmentVariable("GITHUB_USER");
|
||||||
static string API_TOKEN = Environment.GetEnvironmentVariable("GITHUB_API_TOKEN");
|
static string API_TOKEN = Environment.GetEnvironmentVariable("GITHUB_API_TOKEN");
|
||||||
@ -160,7 +157,6 @@ namespace PlaywrightTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ...
|
// ...
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -217,12 +213,11 @@ using Microsoft.Playwright.NUnit;
|
|||||||
using Microsoft.Playwright;
|
using Microsoft.Playwright;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace PlaywrightTests
|
namespace PlaywrightTests;
|
||||||
{
|
|
||||||
|
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestGitHubAPI : PlaywrightTest
|
public class TestGitHubAPI : PlaywrightTest
|
||||||
{
|
{
|
||||||
static string REPO = "test-repo-2";
|
static string REPO = "test-repo-2";
|
||||||
static string USER = Environment.GetEnvironmentVariable("GITHUB_USER");
|
static string USER = Environment.GetEnvironmentVariable("GITHUB_USER");
|
||||||
static string API_TOKEN = Environment.GetEnvironmentVariable("GITHUB_API_TOKEN");
|
static string API_TOKEN = Environment.GetEnvironmentVariable("GITHUB_API_TOKEN");
|
||||||
@ -333,7 +328,6 @@ namespace PlaywrightTests
|
|||||||
var resp = await Request.DeleteAsync("/repos/" + USER + "/" + REPO);
|
var resp = await Request.DeleteAsync("/repos/" + USER + "/" + REPO);
|
||||||
Assert.True(resp.Ok);
|
Assert.True(resp.Ok);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user