Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .claude/rules/test-categories.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
paths:
- "**/TestCategories.fs"
---

@../../.github/instructions/test-categories.instructions.md
7 changes: 7 additions & 0 deletions .github/instructions/test-categories.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
applyTo: "**/TestCategories.fs"
---

# Test category attributes

Keep the `TestCategoryBaseAttribute` descendants of this file sorted by type name. Add a new attribute at its place in that order, never at the end of the file.
74 changes: 37 additions & 37 deletions tests/Cosmos.Tests/TestCategories.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Every TestCategoryBaseAttribute descendant used to categorize tests in this project, one per operation or
// component, in the same order as the string constants they replace used to be declared in. An abstract
// MSTest attribute whose TestCategories list is picked up by --filter TestCategory=... exactly like
// [<TestCategory>]'s, but self-sufficient: no separate string constant needed to know what to pass it.
// component, sorted by name. An abstract MSTest attribute whose TestCategories list is picked up by
// --filter TestCategory=... exactly like [<TestCategory>]'s, but self-sufficient: no separate string constant needed
// to know what to pass it.
// The categories every test project shares, such as the Cosmos DB Emulator one, live in the test infrastructure project.
namespace FSharp.Azure.Cosmos.Tests

Expand All @@ -16,33 +16,17 @@ type CreateTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Create" |] :> IList<string>

type ReadTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Read" |] :> IList<string>

type ReadManyTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "ReadMany" |] :> IList<string>

type UpsertTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Upsert" |] :> IList<string>

type ReplaceTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Replace" |] :> IList<string>

type PatchTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Patch" |] :> IList<string>

type DeleteTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Delete" |] :> IList<string>

type ReadExtensionsTestCategoryAttribute () =
/// <summary>
/// Categorizes <see cref="IcedTasksProbeTests"/> as both a fast, emulator-free unit test and the probe that gates the
/// use of IcedTasks computation expressions in library code.
/// </summary>
type IcedTasksProbeTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "ReadExtensions" |] :> IList<string>
override _.TestCategories = [| "Unit"; "IcedTasksProbe" |] :> IList<string>

/// <summary>
/// Categorizes an emulator-backed integration test as covering the iteration extensions:
Expand All @@ -52,18 +36,6 @@ type IterationExtensionsTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "IterationExtensions" |] :> IList<string>

type ValidationTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Validation" |] :> IList<string>

/// <summary>
/// Categorizes <see cref="IcedTasksProbeTests"/> as both a fast, emulator-free unit test and the probe that gates the
/// use of IcedTasks computation expressions in library code.
/// </summary>
type IcedTasksProbeTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Unit"; "IcedTasksProbe" |] :> IList<string>

/// <summary>
/// Categorizes <see cref="IterationExtensionsUnitTests"/> as both a fast, emulator-free unit test and coverage for the
/// iteration extensions: <see cref="Microsoft.Azure.Cosmos.FeedIteratorExtensions"/> and
Expand All @@ -73,6 +45,26 @@ type IterationExtensionsUnitTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Unit"; "IterationExtensions" |] :> IList<string>

type PatchTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Patch" |] :> IList<string>

type ReadExtensionsTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "ReadExtensions" |] :> IList<string>

type ReadManyTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "ReadMany" |] :> IList<string>

type ReadTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Read" |] :> IList<string>

type ReplaceTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Replace" |] :> IList<string>

/// <summary>
/// Categorizes <see cref="ResponseMessageTests"/> as both a fast, emulator-free unit test and coverage for the
/// <see cref="FSharp.Azure.Cosmos.ResponseMessageModule"/> module.
Expand All @@ -89,6 +81,14 @@ type TestInfrastructureUnitTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Unit"; "TestInfrastructure" |] :> IList<string>

type UpsertTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Upsert" |] :> IList<string>

type ValidationTestCategoryAttribute () =
inherit TestCategoryBaseAttribute ()
override _.TestCategories = [| "Validation" |] :> IList<string>

/// <summary>
/// Categorizes <see cref="ValueCollectionsTests"/> as both a fast, emulator-free unit test and coverage for the
/// collection functions of <see cref="T:FSharp.Azure.Cosmos.ValueCollections"/>, which every project compiles.
Expand Down
Loading