From c599661f3f95f298dd2921bd78ba6db618d5cbfa Mon Sep 17 00:00:00 2001 From: haraldnilsen Date: Thu, 12 Oct 2023 12:03:34 +0200 Subject: [PATCH] :white_check_mark: created the first working test in the project Co-authored-by: Sindre Kjelsrud --- backend/cinemateketTests/Usings.cs | 1 + .../QueryParameterValidatorsTests.cs | 18 ++++++++++ .../cinemateketTests/cinemateketTests.csproj | 35 +++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 backend/cinemateketTests/Usings.cs create mode 100644 backend/cinemateketTests/ValidatorTests/QueryParameterValidatorsTests.cs create mode 100644 backend/cinemateketTests/cinemateketTests.csproj diff --git a/backend/cinemateketTests/Usings.cs b/backend/cinemateketTests/Usings.cs new file mode 100644 index 0000000..8c927eb --- /dev/null +++ b/backend/cinemateketTests/Usings.cs @@ -0,0 +1 @@ +global using Xunit; \ No newline at end of file diff --git a/backend/cinemateketTests/ValidatorTests/QueryParameterValidatorsTests.cs b/backend/cinemateketTests/ValidatorTests/QueryParameterValidatorsTests.cs new file mode 100644 index 0000000..4a11fca --- /dev/null +++ b/backend/cinemateketTests/ValidatorTests/QueryParameterValidatorsTests.cs @@ -0,0 +1,18 @@ +using Xunit; +using backend; + + +public class QueryParameterValidatorsTests +{ + [Theory] + [InlineData("Star Wars", true)] + [InlineData("", false)] + [InlineData(null, false)] + public void IsValidS_ShouldReturnExpectedResult(string input, bool expectedResult) + { + bool result = QueryParameterValidators.IsValidS(input); + Assert.Equal(expectedResult, result); + } + + // Add more tests for other validators +} \ No newline at end of file diff --git a/backend/cinemateketTests/cinemateketTests.csproj b/backend/cinemateketTests/cinemateketTests.csproj new file mode 100644 index 0000000..084a522 --- /dev/null +++ b/backend/cinemateketTests/cinemateketTests.csproj @@ -0,0 +1,35 @@ + + + + net7.0 + enable + enable + + false + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + +