Skip to content

Commit 36a5fea

Browse files
Fix nullable tests (#3637)
## Why make this change? This change solves issue #3636 ## What is this change? - Removed the `?` symbol from the testing variables in order to allow the project to build properly inside the pipeline ## How was this tested? - [ ] Integration Tests - [ ] Unit Tests - [X] Manual Tests Manually ran the pipeline to ensure that it builds [appropriately](https://msdata.visualstudio.com/CosmosDB/_build/results?buildId=220505243&view=results). ## Sample Request(s) N/A
1 parent 10f616e commit 36a5fea

5 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/Cli.Tests/EndToEndTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ public void TestUpdateEntity()
729729

730730
Assert.IsTrue(_runtimeConfigLoader!.TryLoadConfig(TEST_RUNTIME_CONFIG_FILE, out RuntimeConfig? updateRuntimeConfig));
731731
Assert.IsNotNull(updateRuntimeConfig);
732-
Assert.AreEqual(TEST_ENV_CONN_STRING, updateRuntimeConfig.DataSource.ConnectionString);
732+
Assert.AreEqual(TEST_ENV_CONN_STRING, updateRuntimeConfig.DataSource!.ConnectionString);
733733
Assert.AreEqual(2, updateRuntimeConfig.Entities.Count()); // No new entity added
734734

735735
Assert.IsTrue(updateRuntimeConfig.Entities.ContainsKey("todo"));

src/Cli.Tests/ValidateConfigTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,7 @@ private static Entity BuildSimpleEntity(string source)
944944
{
945945
return new Entity(
946946
Source: new EntitySource(Object: source, Type: EntitySourceType.Table, Parameters: null, KeyFields: null),
947-
GraphQL: new(Singular: null, Plural: null),
947+
GraphQL: new(Singular: string.Empty, Plural: string.Empty),
948948
Fields: null,
949949
Rest: new(EntityRestOptions.DEFAULT_SUPPORTED_VERBS),
950950
Permissions: new[] { new EntityPermission("anonymous", new[] { new EntityAction(EntityActionOperation.Read, null, null) }) },

src/Service.Tests/Configuration/RuntimeConfigLoaderTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ public async Task ChildConfigWithMissingEnvVarsLoadsSuccessfully()
191191
}";
192192

193193
// Save original env var values and clear them to ensure they don't exist.
194-
string? origEndpoint = Environment.GetEnvironmentVariable("NONEXISTENT_OTEL_ENDPOINT");
195-
string? origHeaders = Environment.GetEnvironmentVariable("NONEXISTENT_OTEL_HEADERS");
196-
string? origServiceName = Environment.GetEnvironmentVariable("NONEXISTENT_OTEL_SERVICE_NAME");
194+
string origEndpoint = Environment.GetEnvironmentVariable("NONEXISTENT_OTEL_ENDPOINT");
195+
string origHeaders = Environment.GetEnvironmentVariable("NONEXISTENT_OTEL_HEADERS");
196+
string origServiceName = Environment.GetEnvironmentVariable("NONEXISTENT_OTEL_SERVICE_NAME");
197197
Environment.SetEnvironmentVariable("NONEXISTENT_OTEL_ENDPOINT", null);
198198
Environment.SetEnvironmentVariable("NONEXISTENT_OTEL_HEADERS", null);
199199
Environment.SetEnvironmentVariable("NONEXISTENT_OTEL_SERVICE_NAME", null);

src/Service.Tests/UnitTests/RequestParserUnitTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class RequestParserUnitTests
3535
public void ExtractRawQueryParameter_PreservesEncoding(string queryString, string parameterName, string expectedValue)
3636
{
3737
// Call the internal method directly (no reflection needed)
38-
string? result = RequestParser.ExtractRawQueryParameter(queryString, parameterName);
38+
string result = RequestParser.ExtractRawQueryParameter(queryString, parameterName);
3939

4040
Assert.AreEqual(expectedValue, result,
4141
$"Expected '{expectedValue}' but got '{result}' for parameter '{parameterName}' in query '{queryString}'");
@@ -49,10 +49,10 @@ public void ExtractRawQueryParameter_PreservesEncoding(string queryString, strin
4949
[DataRow("", "$filter", DisplayName = "Empty query string")]
5050
[DataRow(null, "$filter", DisplayName = "Null query string")]
5151
[DataRow("?otherParam=value", "$filter", DisplayName = "Different parameter")]
52-
public void ExtractRawQueryParameter_ReturnsNull_WhenParameterNotFound(string? queryString, string parameterName)
52+
public void ExtractRawQueryParameter_ReturnsNull_WhenParameterNotFound(string queryString, string parameterName)
5353
{
5454
// Call the internal method directly (no reflection needed)
55-
string? result = RequestParser.ExtractRawQueryParameter(queryString, parameterName);
55+
string result = RequestParser.ExtractRawQueryParameter(queryString, parameterName);
5656

5757
Assert.IsNull(result,
5858
$"Expected null but got '{result}' for parameter '{parameterName}' in query '{queryString}'");
@@ -71,7 +71,7 @@ public void ExtractRawQueryParameter_ReturnsNull_WhenParameterNotFound(string? q
7171
public void ExtractRawQueryParameter_HandlesEdgeCases(string queryString, string parameterName, string expectedValue)
7272
{
7373
// Call the internal method directly (no reflection needed)
74-
string? result = RequestParser.ExtractRawQueryParameter(queryString, parameterName);
74+
string result = RequestParser.ExtractRawQueryParameter(queryString, parameterName);
7575

7676
Assert.AreEqual(expectedValue, result,
7777
$"Expected '{expectedValue}' but got '{result}' for parameter '{parameterName}' in query '{queryString}'");

src/Service.Tests/UnitTests/SqlQueryExecutorUnitTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -950,8 +950,8 @@ public void TestOboNoUserContext_UsesBaseConnectionString()
950950
[DataRow(null, null, "iss and oid/sub",
951951
DisplayName = "Authenticated user with no claims throws OboAuthenticationFailure")]
952952
public void TestOboEnabled_AuthenticatedUserMissingClaims_ThrowsException(
953-
string? issuer,
954-
string? objectId,
953+
string issuer,
954+
string objectId,
955955
string missingClaimDescription)
956956
{
957957
// Arrange - Create an authenticated HttpContext with incomplete claims
@@ -986,8 +986,8 @@ public void TestOboEnabled_AuthenticatedUserMissingClaims_ThrowsException(
986986
/// <param name="objectId">The oid claim value, or null to omit.</param>
987987
/// <returns>A configured HttpContextAccessor mock with authenticated user.</returns>
988988
private static Mock<IHttpContextAccessor> CreateHttpContextAccessorWithAuthenticatedUserMissingClaims(
989-
string? issuer,
990-
string? objectId)
989+
string issuer,
990+
string objectId)
991991
{
992992
Mock<IHttpContextAccessor> httpContextAccessor = new();
993993
DefaultHttpContext context = new();

0 commit comments

Comments
 (0)