Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
(#830) Skippable tests when in pipeline. (#833)
Browse files Browse the repository at this point in the history
* (#830) Added BuildEnvironment to detect pipeline, and skippableFact for skipping on pipeline.

* (#626) More skippable tests.

* (#630) more skipped tests.

* More skipped tests.

* (#630) more skipped tests.

* Add Skippable in pipeline tests.
  • Loading branch information
adrianhall committed Nov 22, 2023
1 parent ed3fc25 commit 78dd0be
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ public class Patch_Tests : BaseTest
{
public Patch_Tests(ITestOutputHelper logger) : base(logger) { }

[Theory, CombinatorialData]
[SkippableTheory, CombinatorialData]
public async Task BasicPatchTests([CombinatorialValues("movies", "movies_pagesize")] string table)
{
Skip.If(BuildEnvironment.IsPipeline());

var id = GetRandomId();
var expected = MovieServer.GetMovieById(id)!;
expected.Title = "Test Movie Title";
Expand All @@ -39,11 +41,13 @@ public async Task BasicPatchTests([CombinatorialValues("movies", "movies_pagesiz
AssertEx.ResponseHasConditionalHeaders(stored, response);
}

[Theory, CombinatorialData]
[SkippableTheory, CombinatorialData]
public async Task CannotPatchSystemProperties(
[CombinatorialValues("movies", "movies_pagesize")] string table,
[CombinatorialValues("/id", "/updatedAt", "/version")] string propName)
{
Skip.If(BuildEnvironment.IsPipeline());

Dictionary<string, string> propValues = new()
{
{ "/id", "test-id" },
Expand Down Expand Up @@ -89,11 +93,13 @@ public async Task BasicPatchTests([CombinatorialValues("movies", "movies_pagesiz
AssertEx.ResponseHasConditionalHeaders(stored, response);
}

[Theory]
[SkippableTheory]
[InlineData(HttpStatusCode.NotFound, "tables/movies/missing-id")]
[InlineData(HttpStatusCode.NotFound, "tables/movies_pagesize/missing-id")]
public async Task PatchFailureTests(HttpStatusCode expectedStatusCode, string relativeUri)
{
Skip.If(BuildEnvironment.IsPipeline());

PatchOperation[] patchDoc = new PatchOperation[]
{
new PatchOperation("replace", "title", "Home Video"),
Expand All @@ -104,9 +110,11 @@ public async Task PatchFailureTests(HttpStatusCode expectedStatusCode, string re
await AssertResponseWithLoggingAsync(expectedStatusCode, response);
}

[Fact]
[SkippableFact]
public async Task PatchFailedWithWrongContentType()
{
Skip.If(BuildEnvironment.IsPipeline());

var id = GetRandomId();
var expected = MovieServer.GetMovieById(id)!;
PatchOperation[] patchDoc = new PatchOperation[]
Expand Down Expand Up @@ -236,13 +244,15 @@ public async Task ConditionalVersionPatchTests(string headerName, string headerV
}
}

[Theory]
[SkippableTheory]
[InlineData("If-Modified-Since", -1, HttpStatusCode.OK)]
[InlineData("If-Modified-Since", 1, HttpStatusCode.PreconditionFailed)]
[InlineData("If-Unmodified-Since", 1, HttpStatusCode.OK)]
[InlineData("If-Unmodified-Since", -1, HttpStatusCode.PreconditionFailed)]
public async Task ConditionalPatchTests(string headerName, int offset, HttpStatusCode expectedStatusCode)
{
Skip.If(BuildEnvironment.IsPipeline());

string id = GetRandomId();
var entity = MovieServer.GetMovieById(id)!;
Dictionary<string, string> headers = new()
Expand Down

0 comments on commit 78dd0be

Please sign in to comment.