From 72cdcbe584940e34d8cb6ec9dcfb975b492cb76a Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sat, 12 Oct 2024 08:57:06 +0100 Subject: [PATCH 1/5] Renamed Testconstants file and created shared constants --- src/PinguApps.Appwrite.Shared/Constants.cs | 5 +++++ .../AccountClientTests.AddAuthenticator.cs | 22 +++++++++---------- .../Account/AccountClientTests.Create.cs | 10 ++++----- .../AccountClientTests.Create2faChallenge.cs | 16 +++++++------- ...entTests.Create2faChallengeConfirmation.cs | 14 ++++++------ ...countClientTests.CreateAnonymousSession.cs | 10 ++++----- ...tClientTests.CreateEmailPasswordSession.cs | 10 ++++----- .../AccountClientTests.CreateEmailToken.cs | 10 ++++----- ...ountClientTests.CreateEmailVerification.cs | 16 +++++++------- ...sts.CreateEmailVerificationConfirmation.cs | 10 ++++----- .../Account/AccountClientTests.CreateJwt.cs | 16 +++++++------- .../AccountClientTests.CreateMagicUrlToken.cs | 10 ++++----- ...countClientTests.CreateMfaRecoveryCodes.cs | 16 +++++++------- ...countClientTests.CreatePasswordRecovery.cs | 10 ++++----- ...ests.CreatePasswordRecoveryConfirmation.cs | 10 ++++----- .../AccountClientTests.CreatePhoneToken.cs | 10 ++++----- ...ountClientTests.CreatePhoneVerification.cs | 16 +++++++------- .../AccountClientTests.CreateSesssion.cs | 10 ++++----- .../AccountClientTests.DeleteAuthenticator.cs | 22 +++++++++---------- .../AccountClientTests.DeleteIdentity.cs | 18 +++++++-------- .../AccountClientTests.DeleteSession.cs | 18 +++++++-------- .../AccountClientTests.DeleteSessions.cs | 14 ++++++------ .../Clients/Account/AccountClientTests.Get.cs | 16 +++++++------- ...ccountClientTests.GetAccountPreferences.cs | 16 +++++++------- .../AccountClientTests.GetMfaRecoveryCodes.cs | 16 +++++++------- .../Account/AccountClientTests.GetSession.cs | 22 +++++++++---------- .../Account/AccountClientTests.ListFactors.cs | 16 +++++++------- .../AccountClientTests.ListIdentities.cs | 22 +++++++++---------- .../Account/AccountClientTests.ListLogs.cs | 22 +++++++++---------- .../AccountClientTests.ListSessions.cs | 16 +++++++------- ...tClientTests.RegenerateMfaRecoveryCodes.cs | 16 +++++++------- .../Account/AccountClientTests.UpdateEmail.cs | 16 +++++++------- ...ccountClientTests.UpdateMagicUrlSession.cs | 10 ++++----- .../Account/AccountClientTests.UpdateMfa.cs | 16 +++++++------- .../Account/AccountClientTests.UpdateName.cs | 16 +++++++------- .../AccountClientTests.UpdatePassword.cs | 16 +++++++------- .../Account/AccountClientTests.UpdatePhone.cs | 16 +++++++------- .../AccountClientTests.UpdatePhoneSession.cs | 10 ++++----- ...sts.UpdatePhoneVerificationConfirmation.cs | 16 +++++++------- .../AccountClientTests.UpdatePreferences.cs | 16 +++++++------- .../AccountClientTests.UpdateSession.cs | 22 +++++++++---------- .../AccountClientTests.UpdateStatus.cs | 16 +++++++------- .../AccountClientTests.VerifyAuthenticator.cs | 22 +++++++++---------- .../Clients/Account/AccountClientTests.cs | 8 +++---- .../Clients/Account/AccountTestsExtensions.cs | 12 +++++----- .../Clients/AppwriteClientTests.cs | 8 +++---- .../Handlers/HeaderHandlerTests.cs | 4 ++-- .../ServiceCollectionExtensionsTests.cs | 4 ++-- .../Utils/ResponseUtilsTests.cs | 4 ++-- .../Account/AccountClientTests.Create.cs | 10 ++++----- ...countClientTests.CreateAnonymousSession.cs | 10 ++++----- ...tClientTests.CreateEmailPasswordSession.cs | 10 ++++----- .../AccountClientTests.CreateEmailToken.cs | 10 ++++----- .../AccountClientTests.CreateMagicUrlToken.cs | 10 ++++----- .../AccountClientTests.CreatePhoneToken.cs | 10 ++++----- .../AccountClientTests.CreateSession.cs | 10 ++++----- ...ccountClientTests.UpdateMagicUrlSession.cs | 10 ++++----- .../AccountClientTests.UpdatePhoneSession.cs | 10 ++++----- .../Clients/Account/AccountClientTests.cs | 2 +- .../Clients/ClientTestsExtensions.cs | 12 +++++----- ...UsersClientTests.CreateMfaRecoveryCodes.cs | 10 ++++----- .../Users/UsersClientTests.CreateSession.cs | 10 ++++----- .../Users/UsersClientTests.CreateToken.cs | 10 ++++----- .../Users/UsersClientTests.CreateUser.cs | 10 ++++----- .../Users/UsersClientTests.CreateUserJwt.cs | 10 ++++----- .../UsersClientTests.CreateUserTarget.cs | 10 ++++----- ...lientTests.CreateUserWithArgon2Password.cs | 10 ++++----- ...lientTests.CreateUserWithBcryptPassword.cs | 10 ++++----- ...rsClientTests.CreateUserWithMd5Password.cs | 10 ++++----- ...lientTests.CreateUserWithPhpassPassword.cs | 10 ++++----- ...ts.CreateUserWithScryptModifiedPassword.cs | 10 ++++----- ...lientTests.CreateUserWithScryptPassword.cs | 10 ++++----- ...rsClientTests.CreateUserWithShaPassword.cs | 10 ++++----- .../UsersClientTests.DeleteAuthenticator.cs | 8 +++---- .../Users/UsersClientTests.DeleteIdentity.cs | 8 +++---- .../Users/UsersClientTests.DeleteUser.cs | 8 +++---- .../UsersClientTests.DeleteUserSession.cs | 8 +++---- .../UsersClientTests.DeleteUserSessions.cs | 8 +++---- .../UsersClientTests.DeleteUserTarget.cs | 8 +++---- .../UsersClientTests.GetMfaRecoveryCodes.cs | 10 ++++----- .../Clients/Users/UsersClientTests.GetUser.cs | 10 ++++----- .../UsersClientTests.GetUserPreferences.cs | 10 ++++----- .../Users/UsersClientTests.GetUserTarget.cs | 10 ++++----- .../Users/UsersClientTests.ListFactors.cs | 10 ++++----- .../Users/UsersClientTests.ListIdentities.cs | 22 +++++++++---------- .../Users/UsersClientTests.ListUserLogs.cs | 14 ++++++------ .../UsersClientTests.ListUserMemberships.cs | 10 ++++----- .../UsersClientTests.ListUserSessions.cs | 10 ++++----- .../Users/UsersClientTests.ListUserTargets.cs | 14 ++++++------ .../Users/UsersClientTests.ListUsers.cs | 18 +++++++-------- ...sClientTests.RegenerateMfaRecoveryCodes.cs | 10 ++++----- .../Users/UsersClientTests.UpdateEmail.cs | 10 ++++----- ...sersClientTests.UpdateEmailVerification.cs | 10 ++++----- .../Users/UsersClientTests.UpdateMfa.cs | 10 ++++----- .../Users/UsersClientTests.UpdateName.cs | 10 ++++----- .../Users/UsersClientTests.UpdatePassword.cs | 10 ++++----- .../Users/UsersClientTests.UpdatePhone.cs | 10 ++++----- ...sersClientTests.UpdatePhoneVerification.cs | 10 ++++----- .../UsersClientTests.UpdateUserLabels.cs | 10 ++++----- .../UsersClientTests.UpdateUserPreferences.cs | 10 ++++----- .../UsersClientTests.UpdateUserStatus.cs | 10 ++++----- .../UsersClientTests.UpdateUserTarget.cs | 10 ++++----- .../Clients/Users/UsersClientTests.cs | 2 +- .../Handlers/HeaderHandlerTests.cs | 8 +++---- .../ServiceCollectionExtensionsTests.cs | 2 +- .../Utils/ResponseUtilsTests.cs | 4 ++-- .../Responses/IdentityListTests.cs | 2 +- .../Responses/JwtTests.cs | 2 +- .../Responses/LogsListTests.cs | 2 +- .../Responses/MembershipListTests.cs | 2 +- .../Responses/MfaChallengeTests.cs | 2 +- .../Responses/MfaFactorsTests.cs | 2 +- .../Responses/MfaRecoveryCodesTests.cs | 2 +- .../Responses/MfaTypeTests.cs | 2 +- .../Responses/SessionTests.cs | 2 +- .../Responses/SessionsListTests.cs | 2 +- .../Responses/TargetListTests.cs | 2 +- .../Responses/TokenTests.cs | 2 +- .../Responses/UserListTests.cs | 2 +- .../Responses/UserTests.cs | 2 +- .../{Constants.cs => TestConstants.cs} | 2 +- 121 files changed, 639 insertions(+), 634 deletions(-) create mode 100644 src/PinguApps.Appwrite.Shared/Constants.cs rename tests/PinguApps.Appwrite.Shared.Tests/{Constants.cs => TestConstants.cs} (99%) diff --git a/src/PinguApps.Appwrite.Shared/Constants.cs b/src/PinguApps.Appwrite.Shared/Constants.cs new file mode 100644 index 00000000..cf278908 --- /dev/null +++ b/src/PinguApps.Appwrite.Shared/Constants.cs @@ -0,0 +1,5 @@ +namespace PinguApps.Appwrite.Shared; +public static class Constants +{ + public const string Version = "0.2.0"; +} diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.AddAuthenticator.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.AddAuthenticator.cs index 92d300d4..04c84fc8 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.AddAuthenticator.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.AddAuthenticator.cs @@ -13,11 +13,11 @@ public async Task AddAuthenticator_ShouldReturnSuccess_WhenApiCallSucceeds() // Arrange var request = new AddAuthenticatorRequest(); - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/mfa/authenticators/totp") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/mfa/authenticators/totp") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.MfaTypeResponse); + .Respond(TestConstants.AppJson, TestConstants.MfaTypeResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.AddAuthenticator(request); @@ -35,12 +35,12 @@ public async Task AddAuthenticator_ShouldHitDifferentEndpoint_WhenNewTypeIsUsed( { Type = type }; - var requestUri = $"{Constants.Endpoint}/account/mfa/authenticators/{type}"; + var requestUri = $"{TestConstants.Endpoint}/account/mfa/authenticators/{type}"; var mockRequest = _mockHttp.Expect(HttpMethod.Post, requestUri) .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.MfaTypeResponse); + .Respond(TestConstants.AppJson, TestConstants.MfaTypeResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.AddAuthenticator(request); @@ -72,11 +72,11 @@ public async Task AddAuthenticator_ShouldHandleException_WhenApiCallFails() // Arrange var request = new AddAuthenticatorRequest(); - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/mfa/authenticators/totp") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/mfa/authenticators/totp") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.AddAuthenticator(request); @@ -92,11 +92,11 @@ public async Task AddAuthenticator_ShouldReturnErrorResponse_WhenExceptionOccurs // Arrange var request = new AddAuthenticatorRequest(); - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/mfa/authenticators/totp") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/mfa/authenticators/totp") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.AddAuthenticator(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Create.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Create.cs index 5b69eaed..38c6cac3 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Create.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Create.cs @@ -17,10 +17,10 @@ public async Task Create_ShouldReturnSuccess_WhenApiCallSucceeds() Name = "name" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Account.Create(request); @@ -40,10 +40,10 @@ public async Task Create_ShouldHandleException_WhenApiCallFails() Name = "name" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Account.Create(request); @@ -64,7 +64,7 @@ public async Task Create_ShouldReturnErrorResponse_WhenExceptionOccurs() Name = "name" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Create2faChallenge.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Create2faChallenge.cs index 46516628..9229aaae 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Create2faChallenge.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Create2faChallenge.cs @@ -18,12 +18,12 @@ public async Task Create2faChallenge_ShouldReturnSuccess_WhenApiCallSucceeds() var options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase, false)); - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/mfa/challenge") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/mfa/challenge") .ExpectedHeaders(true) .WithJsonContent(request, options) - .Respond(Constants.AppJson, Constants.MfaTypeResponse); + .Respond(TestConstants.AppJson, TestConstants.MfaTypeResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.Create2faChallenge(request); @@ -56,12 +56,12 @@ public async Task Create2faChallenge_ShouldHandleException_WhenApiCallFails() var options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase, false)); - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/mfa/challenge") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/mfa/challenge") .ExpectedHeaders(true) .WithJsonContent(request, options) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.Create2faChallenge(request); @@ -80,12 +80,12 @@ public async Task Create2faChallenge_ShouldReturnErrorResponse_WhenExceptionOccu var options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter(JsonNamingPolicy.CamelCase, false)); - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/mfa/challenge") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/mfa/challenge") .ExpectedHeaders(true) .WithJsonContent(request, options) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.Create2faChallenge(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Create2faChallengeConfirmation.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Create2faChallengeConfirmation.cs index c9e72441..56ba1855 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Create2faChallengeConfirmation.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Create2faChallengeConfirmation.cs @@ -18,12 +18,12 @@ public async Task Create2faChallengeConfirmation_ShouldReturnSuccess_WhenApiCall Otp = "123456" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/mfa/challenge") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/mfa/challenge") .ExpectedHeaders(true) .WithJsonContent(request) .Respond(HttpStatusCode.NoContent); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.Create2faChallengeConfirmation(request); @@ -61,12 +61,12 @@ public async Task Create2faChallengeConfirmation_ShouldHandleException_WhenApiCa Otp = "123456" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/mfa/challenge") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/mfa/challenge") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.Create2faChallengeConfirmation(request); @@ -86,12 +86,12 @@ public async Task Create2faChallengeConfirmation_ShouldReturnErrorResponse_WhenE Otp = "123456" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/mfa/challenge") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/mfa/challenge") .ExpectedHeaders(true) .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.Create2faChallengeConfirmation(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateAnonymousSession.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateAnonymousSession.cs index eed155f5..923932ca 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateAnonymousSession.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateAnonymousSession.cs @@ -9,9 +9,9 @@ public partial class AccountClientTests public async Task CreateAnonymousSession_ShouldReturnSuccess_WhenApiCallSucceeds() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/anonymous") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/anonymous") .ExpectedHeaders(false) - .Respond(Constants.AppJson, Constants.SessionResponse); + .Respond(TestConstants.AppJson, TestConstants.SessionResponse); // Act var result = await _appwriteClient.Account.CreateAnonymousSession(); @@ -24,9 +24,9 @@ public async Task CreateAnonymousSession_ShouldReturnSuccess_WhenApiCallSucceeds public async Task CreateAnonymousSession_ShouldHandleException_WhenApiCallFails() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/anonymous") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/anonymous") .ExpectedHeaders(false) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Account.CreateAnonymousSession(); @@ -40,7 +40,7 @@ public async Task CreateAnonymousSession_ShouldHandleException_WhenApiCallFails( public async Task CreateAnonymousSession_ShouldReturnErrorResponse_WhenExceptionOccurs() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/anonymous") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/anonymous") .ExpectedHeaders(false) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailPasswordSession.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailPasswordSession.cs index 8f11e27f..1d9a7524 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailPasswordSession.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailPasswordSession.cs @@ -16,10 +16,10 @@ public async Task CreateEmailPasswordSession_ShouldReturnSuccess_WhenApiCallSucc Password = "Password" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/email") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/email") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.SessionResponse); + .Respond(TestConstants.AppJson, TestConstants.SessionResponse); // Act var result = await _appwriteClient.Account.CreateEmailPasswordSession(request); @@ -38,10 +38,10 @@ public async Task CreateEmailPasswordSession_ShouldHandleException_WhenApiCallFa Password = "Password" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/email") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/email") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Account.CreateEmailPasswordSession(request); @@ -61,7 +61,7 @@ public async Task CreateEmailPasswordSession_ShouldReturnErrorResponse_WhenExcep Password = "Password" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/email") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/email") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailToken.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailToken.cs index bd0a0bd1..1efe0418 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailToken.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailToken.cs @@ -16,10 +16,10 @@ public async Task CreateEmailToken_ShouldReturnSuccess_WhenApiCallSucceeds() Email = "email@example.com" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/email") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/email") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.TokenResponse); + .Respond(TestConstants.AppJson, TestConstants.TokenResponse); // Act var result = await _appwriteClient.Account.CreateEmailToken(request); @@ -38,10 +38,10 @@ public async Task CreateEmailToken_ShouldHandleException_WhenApiCallFails() Email = "email@example.com" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/email") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/email") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Account.CreateEmailToken(request); @@ -61,7 +61,7 @@ public async Task CreateEmailToken_ShouldReturnErrorResponse_WhenExceptionOccurs Email = "email@example.com" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/email") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/email") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailVerification.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailVerification.cs index bb868ad6..cf453aec 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailVerification.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailVerification.cs @@ -16,12 +16,12 @@ public async Task CreateEmailVerification_ShouldReturnSuccess_WhenApiCallSucceed Url = "https://localhost:5001/abc123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/verification") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/verification") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.TokenResponse); + .Respond(TestConstants.AppJson, TestConstants.TokenResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.CreateEmailVerification(request); @@ -57,12 +57,12 @@ public async Task CreateEmailVerification_ShouldHandleException_WhenApiCallFails Url = "https://localhost:5001/abc123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/verification") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/verification") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.CreateEmailVerification(request); @@ -81,12 +81,12 @@ public async Task CreateEmailVerification_ShouldReturnErrorResponse_WhenExceptio Url = "https://localhost:5001/abc123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/verification") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/verification") .ExpectedHeaders(true) .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.CreateEmailVerification(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailVerificationConfirmation.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailVerificationConfirmation.cs index 88fce1cd..a87c56ea 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailVerificationConfirmation.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateEmailVerificationConfirmation.cs @@ -16,10 +16,10 @@ public async Task CreateEmailVerificationConfirmation_ShouldReturnSuccess_WhenAp Secret = "654321" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/verification") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/verification") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.TokenResponse); + .Respond(TestConstants.AppJson, TestConstants.TokenResponse); // Act var result = await _appwriteClient.Account.CreateEmailVerificationConfirmation(request); @@ -38,10 +38,10 @@ public async Task CreateEmailVerificationConfirmation_ShouldHandleException_When Secret = "654321" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/verification") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/verification") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Account.CreateEmailVerificationConfirmation(request); @@ -61,7 +61,7 @@ public async Task CreateEmailVerificationConfirmation_ShouldReturnErrorResponse_ Secret = "654321" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/verification") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/verification") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateJwt.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateJwt.cs index 72e454d6..effddd17 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateJwt.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateJwt.cs @@ -10,11 +10,11 @@ public partial class AccountClientTests public async Task CreateJwt_ShouldReturnSuccess_WhenApiCallSucceeds() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/jwt") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/jwt") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.JwtResponse); + .Respond(TestConstants.AppJson, TestConstants.JwtResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.CreateJwt(); @@ -39,11 +39,11 @@ public async Task CreateJwt_ShouldReturnError_WhenSessionIsNull() public async Task CreateJwt_ShouldHandleException_WhenApiCallFails() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/jwt") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/jwt") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.CreateJwt(); @@ -57,11 +57,11 @@ public async Task CreateJwt_ShouldHandleException_WhenApiCallFails() public async Task CreateJwt_ShouldReturnErrorResponse_WhenExceptionOccurs() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/jwt") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/jwt") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.CreateJwt(); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateMagicUrlToken.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateMagicUrlToken.cs index 66295770..629be249 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateMagicUrlToken.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateMagicUrlToken.cs @@ -17,10 +17,10 @@ public async Task CreateMagicUrlToken_ShouldReturnSuccess_WhenApiCallSucceeds() Url = "https://localhost:5001/abc123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/magic-url") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/magic-url") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.TokenResponse); + .Respond(TestConstants.AppJson, TestConstants.TokenResponse); // Act var result = await _appwriteClient.Account.CreateMagicUrlToken(request); @@ -40,10 +40,10 @@ public async Task CreateMagicUrlToken_ShouldHandleException_WhenApiCallFails() Url = "https://localhost:5001/abc123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/magic-url") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/magic-url") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Account.CreateMagicUrlToken(request); @@ -64,7 +64,7 @@ public async Task CreateMagicUrlToken_ShouldReturnErrorResponse_WhenExceptionOcc Url = "https://localhost:5001/abc123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/magic-url") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/magic-url") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateMfaRecoveryCodes.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateMfaRecoveryCodes.cs index 2be9b3c3..00d5c016 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateMfaRecoveryCodes.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateMfaRecoveryCodes.cs @@ -10,11 +10,11 @@ public partial class AccountClientTests public async Task CreateMfaRecoveryCodes_ShouldReturnSuccess_WhenApiCallSucceeds() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/mfa/recovery-codes") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.JwtResponse); + .Respond(TestConstants.AppJson, TestConstants.JwtResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.CreateMfaRecoveryCodes(); @@ -39,11 +39,11 @@ public async Task CreateMfaRecoveryCodes_ShouldReturnError_WhenSessionIsNull() public async Task CreateMfaRecoveryCodes_ShouldHandleException_WhenApiCallFails() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/mfa/recovery-codes") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.CreateMfaRecoveryCodes(); @@ -57,11 +57,11 @@ public async Task CreateMfaRecoveryCodes_ShouldHandleException_WhenApiCallFails( public async Task CreateMfaRecoveryCodes_ShouldReturnErrorResponse_WhenExceptionOccurs() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/mfa/recovery-codes") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.CreateMfaRecoveryCodes(); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePasswordRecovery.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePasswordRecovery.cs index bd3b0456..d583f610 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePasswordRecovery.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePasswordRecovery.cs @@ -16,10 +16,10 @@ public async Task CreatePasswordRecovery_ShouldReturnSuccess_WhenApiCallSucceeds Url = "https://localhost:1234/abc" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/recovery") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/recovery") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.TokenResponse); + .Respond(TestConstants.AppJson, TestConstants.TokenResponse); // Act var result = await _appwriteClient.Account.CreatePasswordRecovery(request); @@ -38,10 +38,10 @@ public async Task CreatePasswordRecovery_ShouldHandleException_WhenApiCallFails( Url = "https://localhost:1234/abc" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/recovery") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/recovery") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Account.CreatePasswordRecovery(request); @@ -61,7 +61,7 @@ public async Task CreatePasswordRecovery_ShouldReturnErrorResponse_WhenException Url = "https://localhost:1234/abc" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/recovery") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/recovery") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePasswordRecoveryConfirmation.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePasswordRecoveryConfirmation.cs index db0659e7..1992130a 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePasswordRecoveryConfirmation.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePasswordRecoveryConfirmation.cs @@ -17,10 +17,10 @@ public async Task CreatePasswordRecoveryConfirmation_ShouldReturnSuccess_WhenApi Password = "password" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/recovery") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/recovery") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.TokenResponse); + .Respond(TestConstants.AppJson, TestConstants.TokenResponse); // Act var result = await _appwriteClient.Account.CreatePasswordRecoveryConfirmation(request); @@ -40,10 +40,10 @@ public async Task CreatePasswordRecoveryConfirmation_ShouldHandleException_WhenA Password = "password" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/recovery") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/recovery") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Account.CreatePasswordRecoveryConfirmation(request); @@ -64,7 +64,7 @@ public async Task CreatePasswordRecoveryConfirmation_ShouldReturnErrorResponse_W Password = "password" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/recovery") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/recovery") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePhoneToken.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePhoneToken.cs index 80bc8769..f20296c3 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePhoneToken.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePhoneToken.cs @@ -16,10 +16,10 @@ public async Task CreatePhoneToken_ShouldReturnSuccess_WhenApiCallSucceeds() PhoneNumber = "+16175551212" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/phone") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/phone") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.TokenResponse); + .Respond(TestConstants.AppJson, TestConstants.TokenResponse); // Act var result = await _appwriteClient.Account.CreatePhoneToken(request); @@ -38,10 +38,10 @@ public async Task CreatePhoneToken_ShouldHandleException_WhenApiCallFails() PhoneNumber = "+16175551212" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/phone") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/phone") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Account.CreatePhoneToken(request); @@ -61,7 +61,7 @@ public async Task CreatePhoneToken_ShouldReturnErrorResponse_WhenExceptionOccurs PhoneNumber = "+16175551212" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/phone") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/phone") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePhoneVerification.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePhoneVerification.cs index 51373ad3..176e150d 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePhoneVerification.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreatePhoneVerification.cs @@ -10,11 +10,11 @@ public partial class AccountClientTests public async Task CreatePhoneVerification_ShouldReturnSuccess_WhenApiCallSucceeds() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/verification/phone") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/verification/phone") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.TokenResponse); + .Respond(TestConstants.AppJson, TestConstants.TokenResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.CreatePhoneVerification(); @@ -39,11 +39,11 @@ public async Task CreatePhoneVerification_ShouldReturnError_WhenSessionIsNull() public async Task CreatePhoneVerification_ShouldHandleException_WhenApiCallFails() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/verification/phone") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/verification/phone") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.CreatePhoneVerification(); @@ -57,11 +57,11 @@ public async Task CreatePhoneVerification_ShouldHandleException_WhenApiCallFails public async Task CreatePhoneVerification_ShouldReturnErrorResponse_WhenExceptionOccurs() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/verification/phone") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/verification/phone") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.CreatePhoneVerification(); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateSesssion.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateSesssion.cs index 08942734..c1e3a72d 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateSesssion.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.CreateSesssion.cs @@ -16,10 +16,10 @@ public async Task CreateSession_ShouldReturnSuccess_WhenApiCallSucceeds() Secret = "654321" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/token") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/token") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.SessionResponse); + .Respond(TestConstants.AppJson, TestConstants.SessionResponse); // Act var result = await _appwriteClient.Account.CreateSession(request); @@ -38,10 +38,10 @@ public async Task CreateSession_ShouldHandleException_WhenApiCallFails() Secret = "654321" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/token") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/token") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Account.CreateSession(request); @@ -61,7 +61,7 @@ public async Task CreateSession_ShouldReturnErrorResponse_WhenExceptionOccurs() Secret = "654321" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/token") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/token") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteAuthenticator.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteAuthenticator.cs index 09de6479..6dbb3560 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteAuthenticator.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteAuthenticator.cs @@ -16,12 +16,12 @@ public async Task DeleteAuthenticator_ShouldReturnSuccess_WhenApiCallSucceeds() Otp = "123456" }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/account/mfa/authenticators/totp") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/account/mfa/authenticators/totp") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.MfaTypeResponse); + .Respond(TestConstants.AppJson, TestConstants.MfaTypeResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteAuthenticator(request); @@ -40,13 +40,13 @@ public async Task DeleteAuthenticator_ShouldHitDifferentEndpoint_WhenNewTypeIsUs Type = type, Otp = "123456" }; - var requestUri = $"{Constants.Endpoint}/account/mfa/authenticators/{type}"; + var requestUri = $"{TestConstants.Endpoint}/account/mfa/authenticators/{type}"; var mockRequest = _mockHttp.Expect(HttpMethod.Delete, requestUri) .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.MfaTypeResponse); + .Respond(TestConstants.AppJson, TestConstants.MfaTypeResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteAuthenticator(request); @@ -84,12 +84,12 @@ public async Task DeleteAuthenticator_ShouldHandleException_WhenApiCallFails() Otp = "123456" }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/account/mfa/authenticators/totp") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/account/mfa/authenticators/totp") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteAuthenticator(request); @@ -108,12 +108,12 @@ public async Task DeleteAuthenticator_ShouldReturnErrorResponse_WhenExceptionOcc Otp = "123456" }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/account/mfa/authenticators/totp") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/account/mfa/authenticators/totp") .ExpectedHeaders(true) .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteAuthenticator(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteIdentity.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteIdentity.cs index 465cbda5..315b529f 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteIdentity.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteIdentity.cs @@ -13,11 +13,11 @@ public async Task DeleteIdentity_ShouldReturnSuccess_WhenApiCallSucceeds() // Arrange var request = new DeleteIdentityRequest { IdentityId = "validIdentityId" }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/account/identities/{request.IdentityId}") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/account/identities/{request.IdentityId}") .ExpectedHeaders(true) .Respond(HttpStatusCode.NoContent); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteIdentity(request); @@ -32,12 +32,12 @@ public async Task DeleteIdentity_ShouldHitDifferentEndpoint_WhenNewIdentityIdIsU // Arrange var identityId = "myIdentityId"; var request = new DeleteIdentityRequest { IdentityId = identityId }; - var requestUri = $"{Constants.Endpoint}/account/identities/{identityId}"; + var requestUri = $"{TestConstants.Endpoint}/account/identities/{identityId}"; var mockRequest = _mockHttp.Expect(HttpMethod.Delete, requestUri) .ExpectedHeaders(true) .Respond(HttpStatusCode.NoContent); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteIdentity(request); @@ -69,11 +69,11 @@ public async Task DeleteIdentity_ShouldHandleException_WhenApiCallFails() // Arrange var request = new DeleteIdentityRequest { IdentityId = "validIdentityId" }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/account/identities/{request.IdentityId}") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/account/identities/{request.IdentityId}") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteIdentity(request); @@ -89,11 +89,11 @@ public async Task DeleteIdentity_ShouldReturnErrorResponse_WhenExceptionOccurs() // Arrange var request = new DeleteIdentityRequest { IdentityId = "validIdentityId" }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/account/identities/{request.IdentityId}") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/account/identities/{request.IdentityId}") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteIdentity(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteSession.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteSession.cs index 35f74492..30f8162b 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteSession.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteSession.cs @@ -13,11 +13,11 @@ public async Task DeleteSession_ShouldReturnSuccess_WhenApiCallSucceeds() // Arrange var request = new DeleteSessionRequest(); - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/account/sessions/current") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/account/sessions/current") .ExpectedHeaders(true) .Respond(HttpStatusCode.NoContent); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteSession(request); @@ -35,12 +35,12 @@ public async Task DeleteSession_ShouldHitDifferentEndpoint_WhenNewTypeIsUsed() { SessionId = sessionId }; - var requestUri = $"{Constants.Endpoint}/account/sessions/{sessionId}"; + var requestUri = $"{TestConstants.Endpoint}/account/sessions/{sessionId}"; var mockRequest = _mockHttp.Expect(HttpMethod.Delete, requestUri) .ExpectedHeaders(true) .Respond(HttpStatusCode.NoContent); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteSession(request); @@ -72,11 +72,11 @@ public async Task DeleteSession_ShouldHandleException_WhenApiCallFails() // Arrange var request = new DeleteSessionRequest(); - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/account/sessions/current") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/account/sessions/current") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteSession(request); @@ -92,11 +92,11 @@ public async Task DeleteSession_ShouldReturnErrorResponse_WhenExceptionOccurs() // Arrange var request = new DeleteSessionRequest(); - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/account/sessions/current") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/account/sessions/current") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteSession(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteSessions.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteSessions.cs index 8fec6b9a..3c778648 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteSessions.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.DeleteSessions.cs @@ -10,11 +10,11 @@ public partial class AccountClientTests public async Task DeleteSessions_ShouldReturnSuccess_WhenApiCallSucceeds() { // Arrange - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/account/sessions") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/account/sessions") .ExpectedHeaders(true) .Respond(HttpStatusCode.NoContent); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteSessions(); @@ -39,11 +39,11 @@ public async Task DeleteSessions_ShouldReturnError_WhenSessionIsNull() public async Task DeleteSessions_ShouldHandleException_WhenApiCallFails() { // Arrange - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/account/sessions") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/account/sessions") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteSessions(); @@ -57,11 +57,11 @@ public async Task DeleteSessions_ShouldHandleException_WhenApiCallFails() public async Task DeleteSessions_ShouldReturnErrorResponse_WhenExceptionOccurs() { // Arrange - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/account/sessions") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/account/sessions") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.DeleteSessions(); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Get.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Get.cs index fdfea111..61c46fa1 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Get.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.Get.cs @@ -10,11 +10,11 @@ public partial class AccountClientTests public async Task Get_ShouldReturnSuccess_WhenApiCallSucceeds() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.Get(); @@ -39,11 +39,11 @@ public async Task Get_ShouldReturnError_WhenSessionIsNull() public async Task Get_ShouldHandleException_WhenApiCallFails() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.Get(); @@ -57,11 +57,11 @@ public async Task Get_ShouldHandleException_WhenApiCallFails() public async Task Get_ShouldReturnErrorResponse_WhenExceptionOccurs() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.Get(); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.GetAccountPreferences.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.GetAccountPreferences.cs index f7ba0d8f..4edee25a 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.GetAccountPreferences.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.GetAccountPreferences.cs @@ -10,11 +10,11 @@ public partial class AccountClientTests public async Task GetAccountPreferences_ShouldReturnSuccess_WhenApiCallSucceeds() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/prefs") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/prefs") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.PreferencesResponse); + .Respond(TestConstants.AppJson, TestConstants.PreferencesResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.GetAccountPreferences(); @@ -39,11 +39,11 @@ public async Task GetAccountPreferences_ShouldReturnError_WhenSessionIsNull() public async Task GetAccountPreferences_ShouldHandleException_WhenApiCallFails() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/prefs") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/prefs") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.GetAccountPreferences(); @@ -57,11 +57,11 @@ public async Task GetAccountPreferences_ShouldHandleException_WhenApiCallFails() public async Task GetAccountPreferences_ShouldReturnErrorResponse_WhenExceptionOccurs() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/prefs") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/prefs") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.GetAccountPreferences(); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.GetMfaRecoveryCodes.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.GetMfaRecoveryCodes.cs index b22438f3..0bbb3bca 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.GetMfaRecoveryCodes.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.GetMfaRecoveryCodes.cs @@ -10,11 +10,11 @@ public partial class AccountClientTests public async Task GetMfaRecoveryCodes_ShouldReturnSuccess_WhenApiCallSucceeds() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/mfa/recovery-codes") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.JwtResponse); + .Respond(TestConstants.AppJson, TestConstants.JwtResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.GetMfaRecoveryCodes(); @@ -39,11 +39,11 @@ public async Task GetMfaRecoveryCodes_ShouldReturnError_WhenSessionIsNull() public async Task GetMfaRecoveryCodes_ShouldHandleException_WhenApiCallFails() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/mfa/recovery-codes") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.GetMfaRecoveryCodes(); @@ -57,11 +57,11 @@ public async Task GetMfaRecoveryCodes_ShouldHandleException_WhenApiCallFails() public async Task GetMfaRecoveryCodes_ShouldReturnErrorResponse_WhenExceptionOccurs() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/mfa/recovery-codes") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.GetMfaRecoveryCodes(); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.GetSession.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.GetSession.cs index c31ef18f..d80deba1 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.GetSession.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.GetSession.cs @@ -13,11 +13,11 @@ public async Task GetSession_ShouldReturnSuccess_WhenApiCallSucceeds() // Arrange var request = new GetSessionRequest(); - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/sessions/current") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/sessions/current") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.GetSession(request); @@ -35,11 +35,11 @@ public async Task GetSession_ShouldRequestSession_WhenSessionProvided() SessionId = "123456" }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/sessions/{request.SessionId}") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/sessions/{request.SessionId}") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.GetSession(request); @@ -69,11 +69,11 @@ public async Task GetSession_ShouldHandleException_WhenApiCallFails() // Arrange var request = new GetSessionRequest(); - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/sessions/current") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/sessions/current") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.GetSession(request); @@ -89,11 +89,11 @@ public async Task GetSession_ShouldReturnErrorResponse_WhenExceptionOccurs() // Arrange var request = new GetSessionRequest(); - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/sessions/current") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/sessions/current") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.GetSession(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListFactors.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListFactors.cs index 31ccd23a..e423257b 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListFactors.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListFactors.cs @@ -10,11 +10,11 @@ public partial class AccountClientTests public async Task ListFactors_ShouldReturnSuccess_WhenApiCallSucceeds() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/mfa/factors") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/mfa/factors") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.LogsListResponse); + .Respond(TestConstants.AppJson, TestConstants.LogsListResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.ListFactors(); @@ -39,11 +39,11 @@ public async Task ListFactors_ShouldReturnError_WhenSessionIsNull() public async Task ListFactors_ShouldHandleException_WhenApiCallFails() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/mfa/factors") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/mfa/factors") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.ListFactors(); @@ -57,11 +57,11 @@ public async Task ListFactors_ShouldHandleException_WhenApiCallFails() public async Task ListFactors_ShouldReturnErrorResponse_WhenExceptionOccurs() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/mfa/factors") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/mfa/factors") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.ListFactors(); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListIdentities.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListIdentities.cs index 19443d73..4eb19425 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListIdentities.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListIdentities.cs @@ -14,11 +14,11 @@ public async Task ListIdentities_ShouldReturnSuccess_WhenApiCallSucceeds() // Arrange var request = new ListIdentitiesRequest(); - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/identities") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/identities") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.IdentitiesListResponse); + .Respond(TestConstants.AppJson, TestConstants.IdentitiesListResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.ListIdentities(request); @@ -37,12 +37,12 @@ public async Task ListIdentities_ShouldProvideQueries_WhenQueriesProvided() Queries = [query] }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/identities") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/identities") .ExpectedHeaders(true) .WithQueryString($"queries[]={query.GetQueryString()}") - .Respond(Constants.AppJson, Constants.IdentitiesListResponse); + .Respond(TestConstants.AppJson, TestConstants.IdentitiesListResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.ListIdentities(request); @@ -72,11 +72,11 @@ public async Task ListIdentities_ShouldHandleException_WhenApiCallFails() // Arrange var request = new ListIdentitiesRequest(); - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/identities") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/identities") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.ListIdentities(request); @@ -92,11 +92,11 @@ public async Task ListIdentities_ShouldReturnErrorResponse_WhenExceptionOccurs() // Arrange var request = new ListIdentitiesRequest(); - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/identities") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/identities") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.ListIdentities(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListLogs.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListLogs.cs index b2922fc6..28be93e9 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListLogs.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListLogs.cs @@ -14,11 +14,11 @@ public async Task ListLogs_ShouldReturnSuccess_WhenApiCallSucceeds() // Arrange var request = new ListLogsRequest(); - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/logs") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/logs") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.LogsListResponse); + .Respond(TestConstants.AppJson, TestConstants.LogsListResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.ListLogs(request); @@ -37,12 +37,12 @@ public async Task ListLogs_ShouldProvideQueries_WhenQueriesProvided() Queries = [query] }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/logs") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/logs") .ExpectedHeaders(true) .WithQueryString($"queries[]={query.GetQueryString()}") - .Respond(Constants.AppJson, Constants.LogsListResponse); + .Respond(TestConstants.AppJson, TestConstants.LogsListResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.ListLogs(request); @@ -73,11 +73,11 @@ public async Task ListLogs_ShouldHandleException_WhenApiCallFails() var request = new ListLogsRequest(); // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/logs") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/logs") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.ListLogs(request); @@ -94,11 +94,11 @@ public async Task ListLogs_ShouldReturnErrorResponse_WhenExceptionOccurs() var request = new ListLogsRequest(); // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/logs") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/logs") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.ListLogs(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListSessions.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListSessions.cs index 1d8957e6..9b15c47b 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListSessions.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.ListSessions.cs @@ -10,11 +10,11 @@ public partial class AccountClientTests public async Task ListSessions_ShouldReturnSuccess_WhenApiCallSucceeds() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/sessions") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/sessions") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.SessionsListResponse); + .Respond(TestConstants.AppJson, TestConstants.SessionsListResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.ListSessions(); @@ -39,11 +39,11 @@ public async Task ListSessions_ShouldReturnError_WhenSessionIsNull() public async Task ListSessions_ShouldHandleException_WhenApiCallFails() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/sessions") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/sessions") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.ListSessions(); @@ -57,11 +57,11 @@ public async Task ListSessions_ShouldHandleException_WhenApiCallFails() public async Task ListSessions_ShouldReturnErrorResponse_WhenExceptionOccurs() { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/account/sessions") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/account/sessions") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.ListSessions(); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.RegenerateMfaRecoveryCodes.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.RegenerateMfaRecoveryCodes.cs index 72407f5a..985928c3 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.RegenerateMfaRecoveryCodes.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.RegenerateMfaRecoveryCodes.cs @@ -10,11 +10,11 @@ public partial class AccountClientTests public async Task RegenerateMfaRecoveryCodes_ShouldReturnSuccess_WhenApiCallSucceeds() { // Arrange - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/mfa/recovery-codes") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.JwtResponse); + .Respond(TestConstants.AppJson, TestConstants.JwtResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.RegenerateMfaRecoveryCodes(); @@ -39,11 +39,11 @@ public async Task RegenerateMfaRecoveryCodes_ShouldReturnError_WhenSessionIsNull public async Task RegenerateMfaRecoveryCodes_ShouldHandleException_WhenApiCallFails() { // Arrange - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/mfa/recovery-codes") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.RegenerateMfaRecoveryCodes(); @@ -57,11 +57,11 @@ public async Task RegenerateMfaRecoveryCodes_ShouldHandleException_WhenApiCallFa public async Task RegenerateMfaRecoveryCodes_ShouldReturnErrorResponse_WhenExceptionOccurs() { // Arrange - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/mfa/recovery-codes") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.RegenerateMfaRecoveryCodes(); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateEmail.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateEmail.cs index 4527b331..895ef2d8 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateEmail.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateEmail.cs @@ -17,12 +17,12 @@ public async Task UpdateEmail_ShouldReturnSuccess_WhenApiCallSucceeds() Password = "password" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/email") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/email") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateEmail(request); @@ -60,12 +60,12 @@ public async Task UpdateEmail_ShouldHandleException_WhenApiCallFails() Password = "password" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/email") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/email") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateEmail(request); @@ -85,12 +85,12 @@ public async Task UpdateEmail_ShouldReturnErrorResponse_WhenExceptionOccurs() Password = "password" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/email") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/email") .ExpectedHeaders(true) .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateEmail(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateMagicUrlSession.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateMagicUrlSession.cs index 92d96718..de2d18a4 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateMagicUrlSession.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateMagicUrlSession.cs @@ -16,10 +16,10 @@ public async Task UpdateMagicUrlSession_ShouldReturnSuccess_WhenApiCallSucceeds( Secret = "validSecret" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/sessions/magic-url") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/sessions/magic-url") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.SessionResponse); + .Respond(TestConstants.AppJson, TestConstants.SessionResponse); // Act var result = await _appwriteClient.Account.UpdateMagicUrlSession(request); @@ -38,10 +38,10 @@ public async Task UpdateMagicUrlSession_ShouldHandleException_WhenApiCallFails() Secret = "validSecret" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/sessions/magic-url") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/sessions/magic-url") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Account.UpdateMagicUrlSession(request); @@ -61,7 +61,7 @@ public async Task UpdateMagicUrlSession_ShouldReturnErrorResponse_WhenExceptionO Secret = "validSecret" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/sessions/magic-url") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/sessions/magic-url") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateMfa.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateMfa.cs index 74cea47b..e632ecbf 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateMfa.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateMfa.cs @@ -16,12 +16,12 @@ public async Task UpdateMfa_ShouldReturnSuccess_WhenApiCallSucceeds() MfaEnabled = true }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/mfa") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/mfa") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateMfa(request); @@ -57,12 +57,12 @@ public async Task UpdateMfa_ShouldHandleException_WhenApiCallFails() MfaEnabled = true }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/mfa") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/mfa") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateMfa(request); @@ -81,12 +81,12 @@ public async Task UpdateMfa_ShouldReturnErrorResponse_WhenExceptionOccurs() MfaEnabled = true }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/mfa") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/mfa") .ExpectedHeaders(true) .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateMfa(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateName.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateName.cs index 45323ee7..6ecac0ca 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateName.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateName.cs @@ -16,12 +16,12 @@ public async Task UpdateName_ShouldReturnSuccess_WhenApiCallSucceeds() Name = "newName" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/name") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/name") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateName(request); @@ -57,12 +57,12 @@ public async Task UpdateName_ShouldHandleException_WhenApiCallFails() Name = "newName" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/name") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/name") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateName(request); @@ -81,12 +81,12 @@ public async Task UpdateName_ShouldReturnErrorResponse_WhenExceptionOccurs() Name = "newName" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/name") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/name") .ExpectedHeaders(true) .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateName(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePassword.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePassword.cs index 574ff7ef..24d908c1 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePassword.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePassword.cs @@ -17,12 +17,12 @@ public async Task UpdatePassword_ShouldReturnSuccess_WhenApiCallSucceeds() NewPassword = "newPassword" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/password") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/password") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdatePassword(request); @@ -60,12 +60,12 @@ public async Task UpdatePassword_ShouldHandleException_WhenApiCallFails() NewPassword = "newPassword" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/password") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/password") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdatePassword(request); @@ -85,12 +85,12 @@ public async Task UpdatePassword_ShouldReturnErrorResponse_WhenExceptionOccurs() NewPassword = "newPassword" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/password") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/password") .ExpectedHeaders(true) .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdatePassword(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePhone.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePhone.cs index 5d1b7a06..1a7a65a9 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePhone.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePhone.cs @@ -17,12 +17,12 @@ public async Task UpdatePhone_ShouldReturnSuccess_WhenApiCallSucceeds() Phone = "+14155552671" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/phone") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/phone") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdatePhone(request); @@ -60,12 +60,12 @@ public async Task UpdatePhone_ShouldHandleException_WhenApiCallFails() Phone = "+14155552671" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/phone") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/phone") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdatePhone(request); @@ -85,12 +85,12 @@ public async Task UpdatePhone_ShouldReturnErrorResponse_WhenExceptionOccurs() Phone = "+14155552671" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/phone") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/phone") .ExpectedHeaders(true) .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdatePhone(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePhoneSession.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePhoneSession.cs index 114edc97..8578a84e 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePhoneSession.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePhoneSession.cs @@ -16,10 +16,10 @@ public async Task UpdatePhoneSession_ShouldReturnSuccess_WhenApiCallSucceeds() Secret = "validSecret" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/sessions/phone") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/sessions/phone") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.SessionResponse); + .Respond(TestConstants.AppJson, TestConstants.SessionResponse); // Act var result = await _appwriteClient.Account.UpdatePhoneSession(request); @@ -38,10 +38,10 @@ public async Task UpdatePhoneSession_ShouldHandleException_WhenApiCallFails() Secret = "validSecret" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/sessions/phone") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/sessions/phone") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Account.UpdatePhoneSession(request); @@ -61,7 +61,7 @@ public async Task UpdatePhoneSession_ShouldReturnErrorResponse_WhenExceptionOccu Secret = "validSecret" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/sessions/phone") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/sessions/phone") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePhoneVerificationConfirmation.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePhoneVerificationConfirmation.cs index 80ca72f4..ccf2e724 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePhoneVerificationConfirmation.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePhoneVerificationConfirmation.cs @@ -17,12 +17,12 @@ public async Task UpdatePhoneVerificationConfirmation_ShouldReturnSuccess_WhenAp Secret = "654321" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/verification/phone") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/verification/phone") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.TokenResponse); + .Respond(TestConstants.AppJson, TestConstants.TokenResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdatePhoneVerificationConfirmation(request); @@ -60,12 +60,12 @@ public async Task UpdatePhoneVerificationConfirmation_ShouldHandleException_When Secret = "654321" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/verification/phone") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/verification/phone") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdatePhoneVerificationConfirmation(request); @@ -85,12 +85,12 @@ public async Task UpdatePhoneVerificationConfirmation_ShouldReturnErrorResponse_ Secret = "654321" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/verification/phone") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/verification/phone") .ExpectedHeaders(true) .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdatePhoneVerificationConfirmation(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePreferences.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePreferences.cs index fe6cae01..fce9fd3e 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePreferences.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdatePreferences.cs @@ -16,12 +16,12 @@ public async Task UpdatePreferences_ShouldReturnSuccess_WhenApiCallSucceeds() Preferences = new Dictionary { { "key1", "val1" }, { "key2", "val2" } } }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/prefs") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/prefs") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdatePreferences(request); @@ -57,12 +57,12 @@ public async Task UpdatePreferences_ShouldHandleException_WhenApiCallFails() Preferences = new Dictionary { { "key1", "val1" }, { "key2", "val2" } } }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/prefs") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/prefs") .ExpectedHeaders(true) .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdatePreferences(request); @@ -81,12 +81,12 @@ public async Task UpdatePreferences_ShouldReturnErrorResponse_WhenExceptionOccur Preferences = new Dictionary { { "key1", "val1" }, { "key2", "val2" } } }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/prefs") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/prefs") .ExpectedHeaders(true) .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdatePreferences(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateSession.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateSession.cs index a5995d5e..03a0d296 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateSession.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateSession.cs @@ -14,11 +14,11 @@ public async Task UpdateSession_HitsCurrent_ShouldReturnSuccess_WhenApiCallSucce // Arrange var request = new UpdateSessionRequest(); - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/sessions/current") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/sessions/current") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateSession(request); @@ -36,11 +36,11 @@ public async Task UpdateSession_ShouldReturnSuccess_WhenApiCallSucceeds() SessionId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/sessions/{request.SessionId}") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/sessions/{request.SessionId}") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateSession(request); @@ -70,11 +70,11 @@ public async Task UpdateSession_ShouldHandleException_WhenApiCallFails() // Arrange var request = new UpdateSessionRequest(); - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/sessions/current") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/sessions/current") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateSession(request); @@ -90,11 +90,11 @@ public async Task UpdateSession_ShouldReturnErrorResponse_WhenExceptionOccurs() // Arrange var request = new UpdateSessionRequest(); - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/sessions/current") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/sessions/current") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateSession(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateStatus.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateStatus.cs index e3e300ae..2956da12 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateStatus.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.UpdateStatus.cs @@ -10,11 +10,11 @@ public partial class AccountClientTests public async Task UpdateStatus_ShouldReturnSuccess_WhenApiCallSucceeds() { // Arrange - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/status") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/status") .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateStatus(); @@ -39,11 +39,11 @@ public async Task UpdateStatus_ShouldReturnError_WhenSessionIsNull() public async Task UpdateStatus_ShouldHandleException_WhenApiCallFails() { // Arrange - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/status") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/status") .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateStatus(); @@ -57,11 +57,11 @@ public async Task UpdateStatus_ShouldHandleException_WhenApiCallFails() public async Task UpdateStatus_ShouldReturnErrorResponse_WhenExceptionOccurs() { // Arrange - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/account/status") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/account/status") .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.UpdateStatus(); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.VerifyAuthenticator.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.VerifyAuthenticator.cs index 509628f9..85bc9acd 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.VerifyAuthenticator.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.VerifyAuthenticator.cs @@ -15,12 +15,12 @@ public async Task VerifyAuthenticator_ShouldReturnSuccess_WhenApiCallSucceeds() { Otp = "123456" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/mfa/authenticators/totp") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/mfa/authenticators/totp") .WithJsonContent(request) .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.VerifyAuthenticator(request); @@ -34,7 +34,7 @@ public async Task VerifyAuthenticator_ShouldHitDifferentEndpoint_WhenNewTypeIsUs { // Arrange var type = "newAuth"; - var requestUri = $"{Constants.Endpoint}/account/mfa/authenticators/{type}"; + var requestUri = $"{TestConstants.Endpoint}/account/mfa/authenticators/{type}"; var requestBody = new VerifyAuthenticatorRequest { Otp = "123456", @@ -43,9 +43,9 @@ public async Task VerifyAuthenticator_ShouldHitDifferentEndpoint_WhenNewTypeIsUs var request = _mockHttp.Expect(HttpMethod.Put, requestUri) .WithJsonContent(requestBody) .ExpectedHeaders(true) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.VerifyAuthenticator(requestBody); @@ -82,12 +82,12 @@ public async Task VerifyAuthenticator_ShouldHandleException_WhenApiCallFails() { Otp = "123456" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/mfa/authenticators/totp") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/mfa/authenticators/totp") .WithJsonContent(request) .ExpectedHeaders(true) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.VerifyAuthenticator(request); @@ -105,12 +105,12 @@ public async Task VerifyAuthenticator_ShouldReturnErrorResponse_WhenExceptionOcc { Otp = "123456" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/mfa/authenticators/totp") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/mfa/authenticators/totp") .WithJsonContent(request) .ExpectedHeaders(true) .Throw(new HttpRequestException("An error occurred")); - _appwriteClient.SetSession(Constants.Session); + _appwriteClient.SetSession(TestConstants.Session); // Act var result = await _appwriteClient.Account.VerifyAuthenticator(request); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.cs index 545e960f..4173732d 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountClientTests.cs @@ -18,7 +18,7 @@ public AccountClientTests() _mockHttp = new MockHttpMessageHandler(); var services = new ServiceCollection(); - services.AddAppwriteClientForServer("PROJECT_ID", Constants.Endpoint, new RefitSettings + services.AddAppwriteClientForServer("PROJECT_ID", TestConstants.Endpoint, new RefitSettings { HttpMessageHandlerFactory = () => _mockHttp }); @@ -36,13 +36,13 @@ public void SetSession_UpdatesSession() var mockAccountApi = new Mock(); sc.AddSingleton(mockAccountApi.Object); var sp = sc.BuildServiceProvider(); - var accountClient = new AccountClient(sp, new Config(Constants.Endpoint, Constants.ProjectId)); + var accountClient = new AccountClient(sp, new Config(TestConstants.Endpoint, TestConstants.ProjectId)); var sessionAware = accountClient as ISessionAware; // Act - sessionAware.UpdateSession(Constants.Session); + sessionAware.UpdateSession(TestConstants.Session); // Assert - Assert.Equal(Constants.Session, accountClient.Session); + Assert.Equal(TestConstants.Session, accountClient.Session); } } diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountTestsExtensions.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountTestsExtensions.cs index dd6e9a7c..6deab7c7 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountTestsExtensions.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountTestsExtensions.cs @@ -8,12 +8,12 @@ public static class AccountTestsExtensions public static MockedRequest ExpectedHeaders(this MockedRequest request, bool addSessionHeaders = false) { var req = request - .WithHeaders("x-appwrite-project", Constants.ProjectId) - .WithHeaders("x-sdk-name", Constants.SdkName) + .WithHeaders("x-appwrite-project", TestConstants.ProjectId) + .WithHeaders("x-sdk-name", TestConstants.SdkName) .WithHeaders("x-sdk-platform", "client") - .WithHeaders("x-sdk-language", Constants.SdkLanguage) - .WithHeaders("x-sdk-version", Constants.SdkVersion) - .WithHeaders("x-appwrite-response-format", Constants.AppwriteResponseFormat); + .WithHeaders("x-sdk-language", TestConstants.SdkLanguage) + .WithHeaders("x-sdk-version", TestConstants.SdkVersion) + .WithHeaders("x-appwrite-response-format", TestConstants.AppwriteResponseFormat); if (addSessionHeaders) return req.ExpectSessionHeaders(); @@ -24,6 +24,6 @@ public static MockedRequest ExpectedHeaders(this MockedRequest request, bool add public static MockedRequest ExpectSessionHeaders(this MockedRequest request) { return request - .WithHeaders("x-appwrite-session", Constants.Session); + .WithHeaders("x-appwrite-session", TestConstants.Session); } } diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/AppwriteClientTests.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/AppwriteClientTests.cs index a9b0f41e..4f540707 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/AppwriteClientTests.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/AppwriteClientTests.cs @@ -41,10 +41,10 @@ public void SetSession_UpdatesSession() var appwriteClient = new AppwriteClient(mockAccountClient.Object); // Act - appwriteClient.SetSession(Constants.Session); + appwriteClient.SetSession(TestConstants.Session); // Assert - Assert.Equal(Constants.Session, appwriteClient.Session); + Assert.Equal(TestConstants.Session, appwriteClient.Session); } [Fact] @@ -56,9 +56,9 @@ public void SetSession_UpdatesSessionInAccountClient() var appwriteClient = new AppwriteClient(mockAccountClient.Object); // Act - appwriteClient.SetSession(Constants.Session); + appwriteClient.SetSession(TestConstants.Session); // Assert - mockAccountClient.As().Verify(a => a.UpdateSession(Constants.Session), Times.Once); + mockAccountClient.As().Verify(a => a.UpdateSession(TestConstants.Session), Times.Once); } } diff --git a/tests/PinguApps.Appwrite.Client.Tests/Handlers/HeaderHandlerTests.cs b/tests/PinguApps.Appwrite.Client.Tests/Handlers/HeaderHandlerTests.cs index caeda2d8..669c919a 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Handlers/HeaderHandlerTests.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Handlers/HeaderHandlerTests.cs @@ -21,7 +21,7 @@ public async Task SendAsync_AddsRequiredHeaders() .ReturnsAsync(new HttpResponseMessage()) .Verifiable(); - var config = new Config(Constants.Endpoint, Constants.ProjectId); + var config = new Config(TestConstants.Endpoint, TestConstants.ProjectId); var headerHandler = new HeaderHandler(config) { @@ -38,7 +38,7 @@ public async Task SendAsync_AddsRequiredHeaders() Times.Once(), ItExpr.Is(req => req.Headers.Contains("x-appwrite-project") && - req.Headers.GetValues("x-appwrite-project").Contains(Constants.ProjectId)), + req.Headers.GetValues("x-appwrite-project").Contains(TestConstants.ProjectId)), ItExpr.IsAny() ); } diff --git a/tests/PinguApps.Appwrite.Client.Tests/ServiceCollectionExtensionsTests.cs b/tests/PinguApps.Appwrite.Client.Tests/ServiceCollectionExtensionsTests.cs index f1d65270..d4173171 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/ServiceCollectionExtensionsTests.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/ServiceCollectionExtensionsTests.cs @@ -13,7 +13,7 @@ public void AddAppwriteClient_RegistersExpectedServices() var services = new ServiceCollection(); // Act - services.AddAppwriteClient(Constants.ProjectId, Constants.Endpoint); + services.AddAppwriteClient(TestConstants.ProjectId, TestConstants.Endpoint); // Assert var provider = services.BuildServiceProvider(); @@ -43,7 +43,7 @@ public void AddAppwriteClientForServer_RegistersExpectedServices() var services = new ServiceCollection(); // Act - services.AddAppwriteClientForServer(Constants.ProjectId, Constants.Endpoint); + services.AddAppwriteClientForServer(TestConstants.ProjectId, TestConstants.Endpoint); // Assert var provider = services.BuildServiceProvider(); diff --git a/tests/PinguApps.Appwrite.Client.Tests/Utils/ResponseUtilsTests.cs b/tests/PinguApps.Appwrite.Client.Tests/Utils/ResponseUtilsTests.cs index 07924728..6a1f58d9 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Utils/ResponseUtilsTests.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Utils/ResponseUtilsTests.cs @@ -25,7 +25,7 @@ public async Task GetApiResponse_Failure_ReturnsError() { var response = new HttpResponseMessage(HttpStatusCode.InternalServerError) { - Content = new StringContent(Constants.AppwriteError) + Content = new StringContent(TestConstants.AppwriteError) }; var exception = await ApiException.Create(new HttpRequestMessage(), HttpMethod.Get, response, new RefitSettings()); @@ -93,7 +93,7 @@ public async Task GenericGetApiResponse_Failure_ReturnsError() { var response = new HttpResponseMessage(HttpStatusCode.InternalServerError) { - Content = new StringContent(Constants.AppwriteError) + Content = new StringContent(TestConstants.AppwriteError) }; var exception = await ApiException.Create(new HttpRequestMessage(), HttpMethod.Get, response, new RefitSettings()); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.Create.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.Create.cs index b547de17..56e23072 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.Create.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.Create.cs @@ -18,10 +18,10 @@ public async Task Create_ShouldReturnSuccess_WhenApiCallSucceeds() Name = "name" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteServer.Account.Create(request); @@ -41,10 +41,10 @@ public async Task Create_ShouldHandleException_WhenApiCallFails() Name = "name" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteServer.Account.Create(request); @@ -65,7 +65,7 @@ public async Task Create_ShouldReturnErrorResponse_WhenExceptionOccurs() Name = "name" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateAnonymousSession.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateAnonymousSession.cs index bcc42039..1a1d76f1 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateAnonymousSession.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateAnonymousSession.cs @@ -10,9 +10,9 @@ public partial class AccountClientTests public async Task CreateAnonymousSession_ShouldReturnSuccess_WhenApiCallSucceeds() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/anonymous") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/anonymous") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.SessionResponse); + .Respond(TestConstants.AppJson, TestConstants.SessionResponse); // Act var result = await _appwriteServer.Account.CreateAnonymousSession(); @@ -25,9 +25,9 @@ public async Task CreateAnonymousSession_ShouldReturnSuccess_WhenApiCallSucceeds public async Task CreateAnonymousSession_ShouldHandleException_WhenApiCallFails() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/anonymous") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/anonymous") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteServer.Account.CreateAnonymousSession(); @@ -41,7 +41,7 @@ public async Task CreateAnonymousSession_ShouldHandleException_WhenApiCallFails( public async Task CreateAnonymousSession_ShouldReturnErrorResponse_WhenExceptionOccurs() { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/anonymous") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/anonymous") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateEmailPasswordSession.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateEmailPasswordSession.cs index 3cfdde4f..577b8f61 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateEmailPasswordSession.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateEmailPasswordSession.cs @@ -17,10 +17,10 @@ public async Task CreateEmailPasswordSession_ShouldReturnSuccess_WhenApiCallSucc Password = "Password" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/email") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/email") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.SessionResponse); + .Respond(TestConstants.AppJson, TestConstants.SessionResponse); // Act var result = await _appwriteServer.Account.CreateEmailPasswordSession(request); @@ -39,10 +39,10 @@ public async Task CreateEmailPasswordSession_ShouldHandleException_WhenApiCallFa Password = "Password" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/email") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/email") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteServer.Account.CreateEmailPasswordSession(request); @@ -62,7 +62,7 @@ public async Task CreateEmailPasswordSession_ShouldReturnErrorResponse_WhenExcep Password = "Password" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/email") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/email") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateEmailToken.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateEmailToken.cs index ff513848..d68c6879 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateEmailToken.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateEmailToken.cs @@ -17,10 +17,10 @@ public async Task CreateEmailToken_ShouldReturnSuccess_WhenApiCallSucceeds() Email = "email@example.com" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/email") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/email") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.TokenResponse); + .Respond(TestConstants.AppJson, TestConstants.TokenResponse); // Act var result = await _appwriteServer.Account.CreateEmailToken(request); @@ -39,10 +39,10 @@ public async Task CreateEmailToken_ShouldHandleException_WhenApiCallFails() Email = "email@example.com" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/email") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/email") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteServer.Account.CreateEmailToken(request); @@ -62,7 +62,7 @@ public async Task CreateEmailToken_ShouldReturnErrorResponse_WhenExceptionOccurs Email = "email@example.com" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/email") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/email") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateMagicUrlToken.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateMagicUrlToken.cs index e23c4588..5e1a3fd5 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateMagicUrlToken.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateMagicUrlToken.cs @@ -18,10 +18,10 @@ public async Task CreateMagicUrlToken_ShouldReturnSuccess_WhenApiCallSucceeds() Url = "https://localhost:5001/abc123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/magic-url") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/magic-url") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.TokenResponse); + .Respond(TestConstants.AppJson, TestConstants.TokenResponse); // Act var result = await _appwriteServer.Account.CreateMagicUrlToken(request); @@ -41,10 +41,10 @@ public async Task CreateMagicUrlToken_ShouldHandleException_WhenApiCallFails() Url = "https://localhost:5001/abc123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/magic-url") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/magic-url") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteServer.Account.CreateMagicUrlToken(request); @@ -65,7 +65,7 @@ public async Task CreateMagicUrlToken_ShouldReturnErrorResponse_WhenExceptionOcc Url = "https://localhost:5001/abc123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/magic-url") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/magic-url") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreatePhoneToken.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreatePhoneToken.cs index deee5f90..e12c3e5c 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreatePhoneToken.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreatePhoneToken.cs @@ -17,10 +17,10 @@ public async Task CreatePhoneToken_ShouldReturnSuccess_WhenApiCallSucceeds() PhoneNumber = "+16175551212" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/phone") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/phone") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.TokenResponse); + .Respond(TestConstants.AppJson, TestConstants.TokenResponse); // Act var result = await _appwriteServer.Account.CreatePhoneToken(request); @@ -39,10 +39,10 @@ public async Task CreatePhoneToken_ShouldHandleException_WhenApiCallFails() PhoneNumber = "+16175551212" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/phone") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/phone") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteServer.Account.CreatePhoneToken(request); @@ -62,7 +62,7 @@ public async Task CreatePhoneToken_ShouldReturnErrorResponse_WhenExceptionOccurs PhoneNumber = "+16175551212" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/tokens/phone") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/tokens/phone") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateSession.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateSession.cs index d4dd8644..d921aeb6 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateSession.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.CreateSession.cs @@ -17,10 +17,10 @@ public async Task CreateSession_ShouldReturnSuccess_WhenApiCallSucceeds() Secret = "654321" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/token") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/token") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.SessionResponse); + .Respond(TestConstants.AppJson, TestConstants.SessionResponse); // Act var result = await _appwriteServer.Account.CreateSession(request); @@ -39,10 +39,10 @@ public async Task CreateSession_ShouldHandleException_WhenApiCallFails() Secret = "654321" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/token") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/token") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteServer.Account.CreateSession(request); @@ -62,7 +62,7 @@ public async Task CreateSession_ShouldReturnErrorResponse_WhenExceptionOccurs() Secret = "654321" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/account/sessions/token") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/account/sessions/token") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.UpdateMagicUrlSession.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.UpdateMagicUrlSession.cs index 754169d7..eafebea5 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.UpdateMagicUrlSession.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.UpdateMagicUrlSession.cs @@ -17,10 +17,10 @@ public async Task UpdateMagicUrlSession_ShouldReturnSuccess_WhenApiCallSucceeds( Secret = "validSecret" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/sessions/magic-url") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/sessions/magic-url") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.SessionResponse); + .Respond(TestConstants.AppJson, TestConstants.SessionResponse); // Act var result = await _appwriteServer.Account.UpdateMagicUrlSession(request); @@ -39,10 +39,10 @@ public async Task UpdateMagicUrlSession_ShouldHandleException_WhenApiCallFails() Secret = "validSecret" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/sessions/magic-url") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/sessions/magic-url") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteServer.Account.UpdateMagicUrlSession(request); @@ -62,7 +62,7 @@ public async Task UpdateMagicUrlSession_ShouldReturnErrorResponse_WhenExceptionO Secret = "validSecret" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/sessions/magic-url") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/sessions/magic-url") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.UpdatePhoneSession.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.UpdatePhoneSession.cs index b1678956..f23a1faf 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.UpdatePhoneSession.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.UpdatePhoneSession.cs @@ -17,10 +17,10 @@ public async Task UpdatePhoneSession_ShouldReturnSuccess_WhenApiCallSucceeds() Secret = "validSecret" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/sessions/phone") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/sessions/phone") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.SessionResponse); + .Respond(TestConstants.AppJson, TestConstants.SessionResponse); // Act var result = await _appwriteServer.Account.UpdatePhoneSession(request); @@ -39,10 +39,10 @@ public async Task UpdatePhoneSession_ShouldHandleException_WhenApiCallFails() Secret = "validSecret" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/sessions/phone") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/sessions/phone") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteServer.Account.UpdatePhoneSession(request); @@ -62,7 +62,7 @@ public async Task UpdatePhoneSession_ShouldReturnErrorResponse_WhenExceptionOccu Secret = "validSecret" }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/account/sessions/phone") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/account/sessions/phone") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.cs index 4e121b38..c827a99b 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Account/AccountClientTests.cs @@ -15,7 +15,7 @@ public AccountClientTests() _mockHttp = new MockHttpMessageHandler(); var services = new ServiceCollection(); - services.AddAppwriteServer(Constants.ProjectId, Constants.ApiKey, Constants.Endpoint, new RefitSettings + services.AddAppwriteServer(TestConstants.ProjectId, TestConstants.ApiKey, TestConstants.Endpoint, new RefitSettings { HttpMessageHandlerFactory = () => _mockHttp }); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/ClientTestsExtensions.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/ClientTestsExtensions.cs index 5f3f5e55..654e1665 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/ClientTestsExtensions.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/ClientTestsExtensions.cs @@ -8,12 +8,12 @@ public static class ClientTestsExtensions public static MockedRequest ExpectedHeaders(this MockedRequest request) { return request - .WithHeaders("x-appwrite-project", Constants.ProjectId) - .WithHeaders("x-appwrite-key", Constants.ApiKey) - .WithHeaders("x-sdk-name", Constants.SdkName) + .WithHeaders("x-appwrite-project", TestConstants.ProjectId) + .WithHeaders("x-appwrite-key", TestConstants.ApiKey) + .WithHeaders("x-sdk-name", TestConstants.SdkName) .WithHeaders("x-sdk-platform", "server") - .WithHeaders("x-sdk-language", Constants.SdkLanguage) - .WithHeaders("x-sdk-version", Constants.SdkVersion) - .WithHeaders("x-appwrite-response-format", Constants.AppwriteResponseFormat); + .WithHeaders("x-sdk-language", TestConstants.SdkLanguage) + .WithHeaders("x-sdk-version", TestConstants.SdkVersion) + .WithHeaders("x-appwrite-response-format", TestConstants.AppwriteResponseFormat); } } diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateMfaRecoveryCodes.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateMfaRecoveryCodes.cs index 14ddc468..a65b5642 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateMfaRecoveryCodes.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateMfaRecoveryCodes.cs @@ -16,9 +16,9 @@ public async Task CreateMfaRecoveryCodes_ShouldReturnSuccess_WhenApiCallSucceeds UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.MfaRecoveryCodesResponse); + .Respond(TestConstants.AppJson, TestConstants.MfaRecoveryCodesResponse); // Act var result = await _appwriteClient.Users.CreateMfaRecoveryCodes(request); @@ -36,9 +36,9 @@ public async Task CreateMfaRecoveryCodes_ShouldHandleException_WhenApiCallFails( UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.CreateMfaRecoveryCodes(request); @@ -57,7 +57,7 @@ public async Task CreateMfaRecoveryCodes_ShouldReturnErrorResponse_WhenException UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateSession.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateSession.cs index a0a113a4..019cf7a9 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateSession.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateSession.cs @@ -16,9 +16,9 @@ public async Task CreateSession_ShouldReturnSuccess_WhenApiCallSucceeds() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/{request.UserId}/sessions") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/{request.UserId}/sessions") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.SessionResponse); + .Respond(TestConstants.AppJson, TestConstants.SessionResponse); // Act var result = await _appwriteClient.Users.CreateSession(request); @@ -36,9 +36,9 @@ public async Task CreateSession_ShouldHandleException_WhenApiCallFails() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/{request.UserId}/sessions") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/{request.UserId}/sessions") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.CreateSession(request); @@ -57,7 +57,7 @@ public async Task CreateSession_ShouldReturnErrorResponse_WhenExceptionOccurs() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/{request.UserId}/sessions") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/{request.UserId}/sessions") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateToken.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateToken.cs index 17a10d47..71abec28 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateToken.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateToken.cs @@ -17,9 +17,9 @@ public async Task CreateToken_ShouldReturnSuccess_WhenApiCallSucceeds() // Add other properties as needed }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/{request.UserId}/tokens") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/{request.UserId}/tokens") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.TokenResponse); + .Respond(TestConstants.AppJson, TestConstants.TokenResponse); // Act var result = await _appwriteClient.Users.CreateToken(request); @@ -38,9 +38,9 @@ public async Task CreateToken_ShouldHandleException_WhenApiCallFails() // Add other properties as needed }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/{request.UserId}/tokens") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/{request.UserId}/tokens") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.CreateToken(request); @@ -60,7 +60,7 @@ public async Task CreateToken_ShouldReturnErrorResponse_WhenExceptionOccurs() // Add other properties as needed }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/{request.UserId}/tokens") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/{request.UserId}/tokens") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUser.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUser.cs index f056c578..bbbc025a 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUser.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUser.cs @@ -17,10 +17,10 @@ public async Task CreateUser_ShouldReturnSuccess_WhenApiCallSucceeds() Name = "Pingu" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.CreateUser(request); @@ -40,10 +40,10 @@ public async Task CreateUser_ShouldHandleException_WhenApiCallFails() Name = "Pingu" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.CreateUser(request); @@ -64,7 +64,7 @@ public async Task CreateUser_ShouldReturnErrorResponse_WhenExceptionOccurs() Name = "Pingu" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserJwt.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserJwt.cs index 86cf5da7..c54b2a35 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserJwt.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserJwt.cs @@ -26,10 +26,10 @@ public partial class UsersClientTests public async Task CreateUserJwt_ShouldReturnSuccess_WhenApiCallSucceeds(CreateUserJwtRequest request) { // Arrange - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/{request.UserId}/jwts") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/{request.UserId}/jwts") .WithJsonContent(request) .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.JwtResponse); + .Respond(TestConstants.AppJson, TestConstants.JwtResponse); // Act var result = await _appwriteClient.Users.CreateUserJwt(request); @@ -47,10 +47,10 @@ public async Task CreateUserJwt_ShouldHandleException_WhenApiCallFails() UserId = "user123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/{request.UserId}/jwts") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/{request.UserId}/jwts") .WithJsonContent(request) .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.CreateUserJwt(request); @@ -69,7 +69,7 @@ public async Task CreateUserJwt_ShouldReturnErrorResponse_WhenExceptionOccurs() UserId = "user123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/{request.UserId}/jwts") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/{request.UserId}/jwts") .WithJsonContent(request) .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserTarget.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserTarget.cs index a02ea17c..b3f3b4d0 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserTarget.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserTarget.cs @@ -18,10 +18,10 @@ public async Task CreateUserTarget_ShouldReturnSuccess_WhenApiCallSucceeds() Identifier = "token" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/{request.UserId}/targets") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/{request.UserId}/targets") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.TargetResponse); + .Respond(TestConstants.AppJson, TestConstants.TargetResponse); // Act var result = await _appwriteClient.Users.CreateUserTarget(request); @@ -41,10 +41,10 @@ public async Task CreateUserTarget_ShouldHandleException_WhenApiCallFails() Identifier = "token" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/{request.UserId}/targets") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/{request.UserId}/targets") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.CreateUserTarget(request); @@ -65,7 +65,7 @@ public async Task CreateUserTarget_ShouldReturnErrorResponse_WhenExceptionOccurs Identifier = "token" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/{request.UserId}/targets") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/{request.UserId}/targets") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithArgon2Password.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithArgon2Password.cs index c321f05a..da7f64fc 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithArgon2Password.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithArgon2Password.cs @@ -17,10 +17,10 @@ public async Task CreateUserWithArgon2Password_ShouldReturnSuccess_WhenApiCallSu Name = "Pingu" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/argon2") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/argon2") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.CreateUserWithArgon2Password(request); @@ -40,10 +40,10 @@ public async Task CreateUserWithArgon2Password_ShouldHandleException_WhenApiCall Name = "Pingu" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/argon2") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/argon2") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.CreateUserWithArgon2Password(request); @@ -64,7 +64,7 @@ public async Task CreateUserWithArgon2Password_ShouldReturnErrorResponse_WhenExc Name = "Pingu" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/argon2") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/argon2") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithBcryptPassword.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithBcryptPassword.cs index 29b8b6e6..2e6dd64f 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithBcryptPassword.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithBcryptPassword.cs @@ -17,10 +17,10 @@ public async Task CreateUserWithBcryptPassword_ShouldReturnSuccess_WhenApiCallSu Name = "Pingu" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/bcrypt") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/bcrypt") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.CreateUserWithBcryptPassword(request); @@ -40,10 +40,10 @@ public async Task CreateUserWithBcryptPassword_ShouldHandleException_WhenApiCall Name = "Pingu" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/bcrypt") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/bcrypt") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.CreateUserWithBcryptPassword(request); @@ -64,7 +64,7 @@ public async Task CreateUserWithBcryptPassword_ShouldReturnErrorResponse_WhenExc Name = "Pingu" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/bcrypt") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/bcrypt") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithMd5Password.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithMd5Password.cs index fbb89b07..bf2eecba 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithMd5Password.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithMd5Password.cs @@ -16,10 +16,10 @@ public async Task CreateUserWithMd5Password_ShouldReturnSuccess_WhenApiCallSucce Password = "password123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/md5") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/md5") .WithJsonContent(request) .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.CreateUserWithMd5Password(request); @@ -38,10 +38,10 @@ public async Task CreateUserWithMd5Password_ShouldHandleException_WhenApiCallFai Password = "password123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/md5") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/md5") .WithJsonContent(request) .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.CreateUserWithMd5Password(request); @@ -61,7 +61,7 @@ public async Task CreateUserWithMd5Password_ShouldReturnErrorResponse_WhenExcept Password = "password123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/md5") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/md5") .WithJsonContent(request) .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithPhpassPassword.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithPhpassPassword.cs index 32e7f401..a171e61a 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithPhpassPassword.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithPhpassPassword.cs @@ -16,10 +16,10 @@ public async Task CreateUserWithPhpassPassword_ShouldReturnSuccess_WhenApiCallSu Password = "password123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/phpass") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/phpass") .WithJsonContent(request) .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.CreateUserWithPhpassPassword(request); @@ -38,10 +38,10 @@ public async Task CreateUserWithPhpassPassword_ShouldHandleException_WhenApiCall Password = "password123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/phpass") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/phpass") .WithJsonContent(request) .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.CreateUserWithPhpassPassword(request); @@ -61,7 +61,7 @@ public async Task CreateUserWithPhpassPassword_ShouldReturnErrorResponse_WhenExc Password = "password123" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/phpass") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/phpass") .WithJsonContent(request) .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithScryptModifiedPassword.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithScryptModifiedPassword.cs index af38cbfc..e0a27ef2 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithScryptModifiedPassword.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithScryptModifiedPassword.cs @@ -19,10 +19,10 @@ public async Task CreateUserWithScryptModifiedPassword_ShouldReturnSuccess_WhenA PasswordSignerKey = "SignerKey" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/scrypt-modified") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/scrypt-modified") .WithJsonContent(request) .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.CreateUserWithScryptModifiedPassword(request); @@ -44,10 +44,10 @@ public async Task CreateUserWithScryptModifiedPassword_ShouldHandleException_Whe PasswordSignerKey = "SignerKey" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/scrypt-modified") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/scrypt-modified") .WithJsonContent(request) .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.CreateUserWithScryptModifiedPassword(request); @@ -70,7 +70,7 @@ public async Task CreateUserWithScryptModifiedPassword_ShouldReturnErrorResponse PasswordSignerKey = "SignerKey" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/scrypt-modified") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/scrypt-modified") .WithJsonContent(request) .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithScryptPassword.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithScryptPassword.cs index 70ee5747..f62fcc02 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithScryptPassword.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithScryptPassword.cs @@ -17,10 +17,10 @@ public async Task CreateUserWithScryptPassword_ShouldReturnSuccess_WhenApiCallSu PasswordSalt = "MySalt" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/scrypt") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/scrypt") .WithJsonContent(request) .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.CreateUserWithScryptPassword(request); @@ -40,10 +40,10 @@ public async Task CreateUserWithScryptPassword_ShouldHandleException_WhenApiCall PasswordSalt = "MySalt" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/scrypt") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/scrypt") .WithJsonContent(request) .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.CreateUserWithScryptPassword(request); @@ -64,7 +64,7 @@ public async Task CreateUserWithScryptPassword_ShouldReturnErrorResponse_WhenExc PasswordSalt = "MySalt" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/scrypt") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/scrypt") .WithJsonContent(request) .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithShaPassword.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithShaPassword.cs index added3c2..d7ee7dc0 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithShaPassword.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.CreateUserWithShaPassword.cs @@ -17,10 +17,10 @@ public async Task CreateUserWithShaPassword_ShouldReturnSuccess_WhenApiCallSucce PasswordVersion = "sha256" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/sha") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/sha") .WithJsonContent(request) .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.CreateUserWithShaPassword(request); @@ -40,10 +40,10 @@ public async Task CreateUserWithShaPassword_ShouldHandleException_WhenApiCallFai PasswordVersion = "sha256" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/sha") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/sha") .WithJsonContent(request) .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.CreateUserWithShaPassword(request); @@ -64,7 +64,7 @@ public async Task CreateUserWithShaPassword_ShouldReturnErrorResponse_WhenExcept PasswordVersion = "sha256" }; - _mockHttp.Expect(HttpMethod.Post, $"{Constants.Endpoint}/users/sha") + _mockHttp.Expect(HttpMethod.Post, $"{TestConstants.Endpoint}/users/sha") .WithJsonContent(request) .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteAuthenticator.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteAuthenticator.cs index 300d4634..f76c1f06 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteAuthenticator.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteAuthenticator.cs @@ -17,7 +17,7 @@ public async Task DeleteAuthenticator_ShouldReturnSuccess_WhenApiCallSucceeds() Type = "totp" }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/{request.UserId}/mfa/authenticators/{request.Type}") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/authenticators/{request.Type}") .ExpectedHeaders() .Respond(HttpStatusCode.NoContent); @@ -38,9 +38,9 @@ public async Task DeleteAuthenticator_ShouldHandleException_WhenApiCallFails() Type = "totp" }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/{request.UserId}/mfa/authenticators/{request.Type}") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/authenticators/{request.Type}") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.DeleteAuthenticator(request); @@ -60,7 +60,7 @@ public async Task DeleteAuthenticator_ShouldReturnErrorResponse_WhenExceptionOcc Type = "totp" }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/{request.UserId}/mfa/authenticators/{request.Type}") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/authenticators/{request.Type}") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteIdentity.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteIdentity.cs index 1b706cd0..054d1045 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteIdentity.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteIdentity.cs @@ -17,7 +17,7 @@ public async Task DeleteIdentity_ShouldReturnSuccess_WhenApiCallSucceeds(string IdentityId = identityId }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/identities/{identityId}") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/identities/{identityId}") .ExpectedHeaders() .Respond(HttpStatusCode.NoContent); @@ -37,9 +37,9 @@ public async Task DeleteIdentity_ShouldHandleException_WhenApiCallFails() IdentityId = "identity123" }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/identities/identity123") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/identities/identity123") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.DeleteIdentity(request); @@ -58,7 +58,7 @@ public async Task DeleteIdentity_ShouldReturnErrorResponse_WhenExceptionOccurs() IdentityId = "identity123" }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/identities/identity123") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/identities/identity123") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUser.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUser.cs index 5dbc6008..67248da9 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUser.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUser.cs @@ -17,7 +17,7 @@ public async Task DeleteUser_ShouldReturnSuccess_WhenApiCallSucceeds(string user UserId = userId }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/{userId}") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/{userId}") .ExpectedHeaders() .Respond(HttpStatusCode.NoContent); @@ -38,9 +38,9 @@ public async Task DeleteUser_ShouldHandleException_WhenApiCallFails() UserId = "user123" }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/user123") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/user123") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.DeleteUser(request); @@ -59,7 +59,7 @@ public async Task DeleteUser_ShouldReturnErrorResponse_WhenExceptionOccurs() UserId = "user123" }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/user123") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/user123") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUserSession.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUserSession.cs index 9c8d6e54..20118aa0 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUserSession.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUserSession.cs @@ -17,7 +17,7 @@ public async Task DeleteUserSession_ShouldReturnSuccess_WhenApiCallSucceeds() SessionId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/{request.UserId}/sessions/{request.SessionId}") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/{request.UserId}/sessions/{request.SessionId}") .ExpectedHeaders() .Respond(HttpStatusCode.NoContent); @@ -38,9 +38,9 @@ public async Task DeleteUserSession_ShouldHandleException_WhenApiCallFails() SessionId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/{request.UserId}/sessions/{request.SessionId}") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/{request.UserId}/sessions/{request.SessionId}") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.DeleteUserSession(request); @@ -60,7 +60,7 @@ public async Task DeleteUserSession_ShouldReturnErrorResponse_WhenExceptionOccur SessionId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/{request.UserId}/sessions/{request.SessionId}") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/{request.UserId}/sessions/{request.SessionId}") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUserSessions.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUserSessions.cs index 1c52aeb4..9b776caa 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUserSessions.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUserSessions.cs @@ -16,7 +16,7 @@ public async Task DeleteUserSessions_ShouldReturnSuccess_WhenApiCallSucceeds() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/{request.UserId}/sessions") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/{request.UserId}/sessions") .ExpectedHeaders() .Respond(HttpStatusCode.NoContent); @@ -36,9 +36,9 @@ public async Task DeleteUserSessions_ShouldHandleException_WhenApiCallFails() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/{request.UserId}/sessions") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/{request.UserId}/sessions") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.DeleteUserSessions(request); @@ -57,7 +57,7 @@ public async Task DeleteUserSessions_ShouldReturnErrorResponse_WhenExceptionOccu UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/{request.UserId}/sessions") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/{request.UserId}/sessions") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUserTarget.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUserTarget.cs index b6490b08..1d1bd0b5 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUserTarget.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.DeleteUserTarget.cs @@ -17,7 +17,7 @@ public async Task DeleteUserTarget_ShouldReturnSuccess_WhenApiCallSucceeds() TargetId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") .ExpectedHeaders() .Respond(HttpStatusCode.NoContent); @@ -38,9 +38,9 @@ public async Task DeleteUserTarget_ShouldHandleException_WhenApiCallFails() TargetId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.DeleteUserTarget(request); @@ -60,7 +60,7 @@ public async Task DeleteUserTarget_ShouldReturnErrorResponse_WhenExceptionOccurs TargetId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Delete, $"{Constants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") + _mockHttp.Expect(HttpMethod.Delete, $"{TestConstants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetMfaRecoveryCodes.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetMfaRecoveryCodes.cs index 828f71d9..638239c3 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetMfaRecoveryCodes.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetMfaRecoveryCodes.cs @@ -16,9 +16,9 @@ public async Task GetMfaRecoveryCodes_ShouldReturnSuccess_WhenApiCallSucceeds() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.MfaRecoveryCodesResponse); + .Respond(TestConstants.AppJson, TestConstants.MfaRecoveryCodesResponse); // Act var result = await _appwriteClient.Users.GetMfaRecoveryCodes(request); @@ -36,9 +36,9 @@ public async Task GetMfaRecoveryCodes_ShouldHandleException_WhenApiCallFails() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.GetMfaRecoveryCodes(request); @@ -57,7 +57,7 @@ public async Task GetMfaRecoveryCodes_ShouldReturnErrorResponse_WhenExceptionOcc UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetUser.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetUser.cs index 25092db7..2c723e00 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetUser.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetUser.cs @@ -17,9 +17,9 @@ public async Task GetUser_ShouldReturnSuccess_WhenApiCallSucceeds(string userId) UserId = userId }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{userId}") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{userId}") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.GetUser(request); @@ -37,9 +37,9 @@ public async Task GetUser_ShouldHandleException_WhenApiCallFails() UserId = "user123" }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/user123") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/user123") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.GetUser(request); @@ -58,7 +58,7 @@ public async Task GetUser_ShouldReturnErrorResponse_WhenExceptionOccurs() UserId = "user123" }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/user123") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/user123") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetUserPreferences.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetUserPreferences.cs index 55241930..3e6c58f9 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetUserPreferences.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetUserPreferences.cs @@ -16,9 +16,9 @@ public async Task GetUserPreferences_ShouldReturnSuccess_WhenApiCallSucceeds() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/prefs") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/prefs") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.PreferencesResponse); + .Respond(TestConstants.AppJson, TestConstants.PreferencesResponse); // Act var result = await _appwriteClient.Users.GetUserPreferences(request); @@ -36,9 +36,9 @@ public async Task GetUserPreferences_ShouldHandleException_WhenApiCallFails() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/prefs") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/prefs") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.GetUserPreferences(request); @@ -57,7 +57,7 @@ public async Task GetUserPreferences_ShouldReturnErrorResponse_WhenExceptionOccu UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/prefs") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/prefs") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetUserTarget.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetUserTarget.cs index 6346be5f..a7d25dbd 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetUserTarget.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.GetUserTarget.cs @@ -17,9 +17,9 @@ public async Task GetUserTarget_ShouldReturnSuccess_WhenApiCallSucceeds() TargetId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.TargetResponse); + .Respond(TestConstants.AppJson, TestConstants.TargetResponse); // Act var result = await _appwriteClient.Users.GetUserTarget(request); @@ -38,9 +38,9 @@ public async Task GetUserTarget_ShouldHandleException_WhenApiCallFails() TargetId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.GetUserTarget(request); @@ -60,7 +60,7 @@ public async Task GetUserTarget_ShouldReturnErrorResponse_WhenExceptionOccurs() TargetId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListFactors.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListFactors.cs index 1adeb3e7..93221112 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListFactors.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListFactors.cs @@ -16,9 +16,9 @@ public async Task ListFactors_ShouldReturnSuccess_WhenApiCallSucceeds() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/mfa/factors") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/factors") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.MfaFactorsResponse); + .Respond(TestConstants.AppJson, TestConstants.MfaFactorsResponse); // Act var result = await _appwriteClient.Users.ListFactors(request); @@ -36,9 +36,9 @@ public async Task ListFactors_ShouldHandleException_WhenApiCallFails() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/mfa/factors") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/factors") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.ListFactors(request); @@ -57,7 +57,7 @@ public async Task ListFactors_ShouldReturnErrorResponse_WhenExceptionOccurs() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/mfa/factors") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/factors") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListIdentities.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListIdentities.cs index 64705880..8e7b5ba3 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListIdentities.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListIdentities.cs @@ -13,9 +13,9 @@ public async Task ListIdentities_ShouldReturnSuccess_WhenApiCallSucceeds() // Arrange var request = new ListIdentitiesRequest(); - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/identities") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/identities") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.IdentitiesListResponse); + .Respond(TestConstants.AppJson, TestConstants.IdentitiesListResponse); // Act var result = await _appwriteClient.Users.ListIdentities(request); @@ -34,10 +34,10 @@ public async Task ListIdentities_ShouldProvideQueries_WhenQueriesProvided() Queries = [query] }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/identities") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/identities") .ExpectedHeaders() .WithQueryString($"queries[]={query.GetQueryString()}") - .Respond(Constants.AppJson, Constants.IdentitiesListResponse); + .Respond(TestConstants.AppJson, TestConstants.IdentitiesListResponse); // Act var result = await _appwriteClient.Users.ListIdentities(request); @@ -55,10 +55,10 @@ public async Task ListIdentities_ShouldProvideSearch_WhenSearchProvided() Search = "SearchQuery" }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/identities") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/identities") .ExpectedHeaders() .WithQueryString("search=SearchQuery") - .Respond(Constants.AppJson, Constants.IdentitiesListResponse); + .Respond(TestConstants.AppJson, TestConstants.IdentitiesListResponse); // Act var result = await _appwriteClient.Users.ListIdentities(request); @@ -78,11 +78,11 @@ public async Task ListIdentities_ShouldProvideQueriesAndSearch_WhenBothProvided( Search = "SearchQuery" }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/identities") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/identities") .ExpectedHeaders() .WithQueryString($"queries[]={query.GetQueryString()}") .WithQueryString("search=SearchQuery") - .Respond(Constants.AppJson, Constants.IdentitiesListResponse); + .Respond(TestConstants.AppJson, TestConstants.IdentitiesListResponse); // Act var result = await _appwriteClient.Users.ListIdentities(request); @@ -97,9 +97,9 @@ public async Task ListIdentities_ShouldHandleException_WhenApiCallFails() // Arrange var request = new ListIdentitiesRequest(); - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/identities") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/identities") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.ListIdentities(request); @@ -115,7 +115,7 @@ public async Task ListIdentities_ShouldReturnErrorResponse_WhenExceptionOccurs() // Arrange var request = new ListIdentitiesRequest(); - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/identities") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/identities") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserLogs.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserLogs.cs index 0da2a4fd..983eb329 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserLogs.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserLogs.cs @@ -25,9 +25,9 @@ public partial class UsersClientTests public async Task ListUserLogs_ShouldReturnSuccess_WhenApiCallSucceeds(ListUserLogsRequest request) { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/logs") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/logs") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.LogsListResponse); + .Respond(TestConstants.AppJson, TestConstants.LogsListResponse); // Act var result = await _appwriteClient.Users.ListUserLogs(request); @@ -47,10 +47,10 @@ public async Task ListUserLogs_ShouldProvideQueries_WhenQueriesProvided() Queries = [query] }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/logs") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/logs") .ExpectedHeaders() .WithQueryString($"queries[]={query.GetQueryString()}") - .Respond(Constants.AppJson, Constants.LogsListResponse); + .Respond(TestConstants.AppJson, TestConstants.LogsListResponse); // Act var result = await _appwriteClient.Users.ListUserLogs(request); @@ -68,9 +68,9 @@ public async Task ListUserLogs_ShouldHandleException_WhenApiCallFails() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/logs") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/logs") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.ListUserLogs(request); @@ -89,7 +89,7 @@ public async Task ListUserLogs_ShouldReturnErrorResponse_WhenExceptionOccurs() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/logs") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/logs") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserMemberships.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserMemberships.cs index ec289f3f..183241ec 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserMemberships.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserMemberships.cs @@ -16,9 +16,9 @@ public async Task ListUserMemberships_ShouldReturnSuccess_WhenApiCallSucceeds() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/memberships") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/memberships") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.MembershipsListResponse); + .Respond(TestConstants.AppJson, TestConstants.MembershipsListResponse); // Act var result = await _appwriteClient.Users.ListUserMemberships(request); @@ -36,9 +36,9 @@ public async Task ListUserMemberships_ShouldHandleException_WhenApiCallFails() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/memberships") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/memberships") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.ListUserMemberships(request); @@ -57,7 +57,7 @@ public async Task ListUserMemberships_ShouldReturnErrorResponse_WhenExceptionOcc UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/memberships") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/memberships") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserSessions.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserSessions.cs index 5cf4a868..d8395328 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserSessions.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserSessions.cs @@ -16,9 +16,9 @@ public async Task ListUserSessions_ShouldReturnSuccess_WhenApiCallSucceeds() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/sessions") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/sessions") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.SessionsListResponse); + .Respond(TestConstants.AppJson, TestConstants.SessionsListResponse); // Act var result = await _appwriteClient.Users.ListUserSessions(request); @@ -36,9 +36,9 @@ public async Task ListUserSessions_ShouldHandleException_WhenApiCallFails() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/sessions") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/sessions") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.ListUserSessions(request); @@ -57,7 +57,7 @@ public async Task ListUserSessions_ShouldReturnErrorResponse_WhenExceptionOccurs UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/sessions") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/sessions") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserTargets.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserTargets.cs index f230cbeb..80ea3360 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserTargets.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUserTargets.cs @@ -25,9 +25,9 @@ public partial class UsersClientTests public async Task ListUserTargets_ShouldReturnSuccess_WhenApiCallSucceeds(ListUserTargetsRequest request) { // Arrange - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/targets") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/targets") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.TargetListResponse); + .Respond(TestConstants.AppJson, TestConstants.TargetListResponse); // Act var result = await _appwriteClient.Users.ListUserTargets(request); @@ -47,10 +47,10 @@ public async Task ListUserTargets_ShouldProvideQueries_WhenQueriesProvided() Queries = [query] }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/targets") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/targets") .ExpectedHeaders() .WithQueryString($"queries[]={query.GetQueryString()}") - .Respond(Constants.AppJson, Constants.TargetListResponse); + .Respond(TestConstants.AppJson, TestConstants.TargetListResponse); // Act var result = await _appwriteClient.Users.ListUserTargets(request); @@ -68,9 +68,9 @@ public async Task ListUserTargets_ShouldHandleException_WhenApiCallFails() UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/targets") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/targets") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.ListUserTargets(request); @@ -89,7 +89,7 @@ public async Task ListUserTargets_ShouldReturnErrorResponse_WhenExceptionOccurs( UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users/{request.UserId}/targets") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users/{request.UserId}/targets") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUsers.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUsers.cs index 3b9876dc..d6881590 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUsers.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.ListUsers.cs @@ -13,9 +13,9 @@ public async Task ListUsers_ShouldReturnSuccess_WhenApiCallSucceeds() // Arrange var request = new ListUsersRequest(); - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.UsersListResponse); + .Respond(TestConstants.AppJson, TestConstants.UsersListResponse); // Act var result = await _appwriteClient.Users.ListUsers(request); @@ -34,10 +34,10 @@ public async Task ListUsers_ShouldProvideQueries_WhenQueriesProvided() Queries = [query] }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users") .ExpectedHeaders() .WithQueryString($"queries[]={query.GetQueryString()}") - .Respond(Constants.AppJson, Constants.UsersListResponse); + .Respond(TestConstants.AppJson, TestConstants.UsersListResponse); // Act var result = await _appwriteClient.Users.ListUsers(request); @@ -55,10 +55,10 @@ public async Task ListUsers_ShouldProvideSearch_WhenSearchProvided() Search = "SearchQuery" }; - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users") .ExpectedHeaders() .WithQueryString($"search=SearchQuery") - .Respond(Constants.AppJson, Constants.UsersListResponse); + .Respond(TestConstants.AppJson, TestConstants.UsersListResponse); // Act var result = await _appwriteClient.Users.ListUsers(request); @@ -73,9 +73,9 @@ public async Task ListUsers_ShouldHandleException_WhenApiCallFails() // Arrange var request = new ListUsersRequest(); - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.ListUsers(request); @@ -91,7 +91,7 @@ public async Task ListUsers_ShouldReturnErrorResponse_WhenExceptionOccurs() // Arrange var request = new ListUsersRequest(); - _mockHttp.Expect(HttpMethod.Get, $"{Constants.Endpoint}/users") + _mockHttp.Expect(HttpMethod.Get, $"{TestConstants.Endpoint}/users") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.RegenerateMfaRecoveryCodes.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.RegenerateMfaRecoveryCodes.cs index 0b9d86bc..a799051c 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.RegenerateMfaRecoveryCodes.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.RegenerateMfaRecoveryCodes.cs @@ -16,9 +16,9 @@ public async Task RegenerateMfaRecoveryCodes_ShouldReturnSuccess_WhenApiCallSucc UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.MfaRecoveryCodesResponse); + .Respond(TestConstants.AppJson, TestConstants.MfaRecoveryCodesResponse); // Act var result = await _appwriteClient.Users.RegenerateMfaRecoveryCodes(request); @@ -36,9 +36,9 @@ public async Task RegenerateMfaRecoveryCodes_ShouldHandleException_WhenApiCallFa UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.RegenerateMfaRecoveryCodes(request); @@ -57,7 +57,7 @@ public async Task RegenerateMfaRecoveryCodes_ShouldReturnErrorResponse_WhenExcep UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa/recovery-codes") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateEmail.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateEmail.cs index 97e89516..5318bb41 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateEmail.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateEmail.cs @@ -18,10 +18,10 @@ public async Task UpdateEmail_ShouldReturnSuccess_WhenApiCallSucceeds(string use Email = newEmail }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{userId}/email") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{userId}/email") .WithJsonContent(request) .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.UpdateEmail(request); @@ -40,10 +40,10 @@ public async Task UpdateEmail_ShouldHandleException_WhenApiCallFails() Email = "newemail@example.com" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/user123/email") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/user123/email") .WithJsonContent(request) .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.UpdateEmail(request); @@ -63,7 +63,7 @@ public async Task UpdateEmail_ShouldReturnErrorResponse_WhenExceptionOccurs() Email = "newemail@example.com" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/user123/email") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/user123/email") .WithJsonContent(request) .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateEmailVerification.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateEmailVerification.cs index e1881634..5bfcebb0 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateEmailVerification.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateEmailVerification.cs @@ -17,10 +17,10 @@ public async Task UpdateEmailVerification_ShouldReturnSuccess_WhenApiCallSucceed // Add other properties as needed }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/verification") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/verification") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.UpdateEmailVerification(request); @@ -39,10 +39,10 @@ public async Task UpdateEmailVerification_ShouldHandleException_WhenApiCallFails // Add other properties as needed }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/verification") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/verification") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.UpdateEmailVerification(request); @@ -62,7 +62,7 @@ public async Task UpdateEmailVerification_ShouldReturnErrorResponse_WhenExceptio // Add other properties as needed }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/verification") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/verification") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateMfa.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateMfa.cs index 8e14adc9..a188279a 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateMfa.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateMfa.cs @@ -17,10 +17,10 @@ public async Task UpdateMfa_ShouldReturnSuccess_WhenApiCallSucceeds() Mfa = true }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/mfa") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa") .WithJsonContent(request) .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.UpdateMfa(request); @@ -39,10 +39,10 @@ public async Task UpdateMfa_ShouldHandleException_WhenApiCallFails() Mfa = true }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/mfa") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa") .WithJsonContent(request) .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.UpdateMfa(request); @@ -62,7 +62,7 @@ public async Task UpdateMfa_ShouldReturnErrorResponse_WhenExceptionOccurs() Mfa = true }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/mfa") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/mfa") .WithJsonContent(request) .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateName.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateName.cs index 67ece298..9411499d 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateName.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateName.cs @@ -17,9 +17,9 @@ public async Task UpdateName_ShouldReturnSuccess_WhenApiCallSucceeds() Name = "New Name" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/name") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/name") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.UpdateName(request); @@ -38,9 +38,9 @@ public async Task UpdateName_ShouldHandleException_WhenApiCallFails() Name = "New Name" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/name") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/name") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.UpdateName(request); @@ -60,7 +60,7 @@ public async Task UpdateName_ShouldReturnErrorResponse_WhenExceptionOccurs() Name = "New Name" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/name") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/name") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdatePassword.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdatePassword.cs index 6ec1268e..9fef297c 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdatePassword.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdatePassword.cs @@ -17,9 +17,9 @@ public async Task UpdatePassword_ShouldReturnSuccess_WhenApiCallSucceeds() Password = "newPassword" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/password") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/password") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.UpdatePassword(request); @@ -38,9 +38,9 @@ public async Task UpdatePassword_ShouldHandleException_WhenApiCallFails() Password = "newPassword" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/password") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/password") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.UpdatePassword(request); @@ -60,7 +60,7 @@ public async Task UpdatePassword_ShouldReturnErrorResponse_WhenExceptionOccurs() Password = "newPassword" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/password") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/password") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdatePhone.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdatePhone.cs index f44e4a80..c39bb5d6 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdatePhone.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdatePhone.cs @@ -17,9 +17,9 @@ public async Task UpdatePhone_ShouldReturnSuccess_WhenApiCallSucceeds() PhoneNumber = "+1234567890" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/phone") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/phone") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.UpdatePhone(request); @@ -38,9 +38,9 @@ public async Task UpdatePhone_ShouldHandleException_WhenApiCallFails() PhoneNumber = "+1234567890" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/phone") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/phone") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.UpdatePhone(request); @@ -60,7 +60,7 @@ public async Task UpdatePhone_ShouldReturnErrorResponse_WhenExceptionOccurs() PhoneNumber = "+1234567890" }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/phone") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/phone") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdatePhoneVerification.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdatePhoneVerification.cs index c2a1cb5b..61c490ec 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdatePhoneVerification.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdatePhoneVerification.cs @@ -16,10 +16,10 @@ public async Task UpdatePhoneVerification_ShouldReturnSuccess_WhenApiCallSucceed UserId = IdUtils.GenerateUniqueId() }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/verification/phone") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/verification/phone") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.UpdatePhoneVerification(request); @@ -38,10 +38,10 @@ public async Task UpdatePhoneVerification_ShouldHandleException_WhenApiCallFails // Add other properties as needed }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/verification/phone") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/verification/phone") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.UpdatePhoneVerification(request); @@ -61,7 +61,7 @@ public async Task UpdatePhoneVerification_ShouldReturnErrorResponse_WhenExceptio // Add other properties as needed }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/verification/phone") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/verification/phone") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserLabels.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserLabels.cs index 8454c1e3..2f72dcd2 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserLabels.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserLabels.cs @@ -26,10 +26,10 @@ public partial class UsersClientTests public async Task UpdateUserLabels_ShouldReturnSuccess_WhenApiCallSucceeds(UpdateUserLabelsRequest request) { // Arrange - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/users/{request.UserId}/labels") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/users/{request.UserId}/labels") .WithJsonContent(request) .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.UpdateUserLabels(request); @@ -48,10 +48,10 @@ public async Task UpdateUserLabels_ShouldHandleException_WhenApiCallFails() Labels = ["label1", "label2"] }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/users/user123/labels") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/users/user123/labels") .WithJsonContent(request) .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.UpdateUserLabels(request); @@ -71,7 +71,7 @@ public async Task UpdateUserLabels_ShouldReturnErrorResponse_WhenExceptionOccurs Labels = ["label1", "label2"] }; - _mockHttp.Expect(HttpMethod.Put, $"{Constants.Endpoint}/users/user123/labels") + _mockHttp.Expect(HttpMethod.Put, $"{TestConstants.Endpoint}/users/user123/labels") .WithJsonContent(request) .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserPreferences.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserPreferences.cs index d01307d6..856b17b0 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserPreferences.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserPreferences.cs @@ -21,10 +21,10 @@ public async Task UpdateUserPreferences_ShouldReturnSuccess_WhenApiCallSucceeds( } }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/prefs") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/prefs") .WithJsonContent(request) .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.PreferencesResponse); + .Respond(TestConstants.AppJson, TestConstants.PreferencesResponse); // Act var result = await _appwriteClient.Users.UpdateUserPreferences(request); @@ -47,10 +47,10 @@ public async Task UpdateUserPreferences_ShouldHandleException_WhenApiCallFails() } }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/prefs") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/prefs") .WithJsonContent(request) .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.UpdateUserPreferences(request); @@ -74,7 +74,7 @@ public async Task UpdateUserPreferences_ShouldReturnErrorResponse_WhenExceptionO } }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/prefs") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/prefs") .WithJsonContent(request) .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserStatus.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserStatus.cs index dd6564c7..c34052bf 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserStatus.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserStatus.cs @@ -17,10 +17,10 @@ public async Task UpdateUserStatus_ShouldReturnSuccess_WhenApiCallSucceeds() Status = true }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/status") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/status") .ExpectedHeaders() .WithJsonContent(request) - .Respond(Constants.AppJson, Constants.UserResponse); + .Respond(TestConstants.AppJson, TestConstants.UserResponse); // Act var result = await _appwriteClient.Users.UpdateUserStatus(request); @@ -39,10 +39,10 @@ public async Task UpdateUserStatus_ShouldHandleException_WhenApiCallFails() Status = true }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/status") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/status") .ExpectedHeaders() .WithJsonContent(request) - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.UpdateUserStatus(request); @@ -62,7 +62,7 @@ public async Task UpdateUserStatus_ShouldReturnErrorResponse_WhenExceptionOccurs Status = true }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/status") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/status") .ExpectedHeaders() .WithJsonContent(request) .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserTarget.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserTarget.cs index 559962dc..d23ec26c 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserTarget.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.UpdateUserTarget.cs @@ -18,9 +18,9 @@ public async Task UpdateUserTarget_ShouldReturnSuccess_WhenApiCallSucceeds() // Add other properties as needed }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") .ExpectedHeaders() - .Respond(Constants.AppJson, Constants.TargetResponse); + .Respond(TestConstants.AppJson, TestConstants.TargetResponse); // Act var result = await _appwriteClient.Users.UpdateUserTarget(request); @@ -40,9 +40,9 @@ public async Task UpdateUserTarget_ShouldHandleException_WhenApiCallFails() // Add other properties as needed }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") .ExpectedHeaders() - .Respond(HttpStatusCode.BadRequest, Constants.AppJson, Constants.AppwriteError); + .Respond(HttpStatusCode.BadRequest, TestConstants.AppJson, TestConstants.AppwriteError); // Act var result = await _appwriteClient.Users.UpdateUserTarget(request); @@ -63,7 +63,7 @@ public async Task UpdateUserTarget_ShouldReturnErrorResponse_WhenExceptionOccurs // Add other properties as needed }; - _mockHttp.Expect(HttpMethod.Patch, $"{Constants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") + _mockHttp.Expect(HttpMethod.Patch, $"{TestConstants.Endpoint}/users/{request.UserId}/targets/{request.TargetId}") .ExpectedHeaders() .Throw(new HttpRequestException("An error occurred")); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.cs index 0aa4d88d..3fcbd236 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/Users/UsersClientTests.cs @@ -15,7 +15,7 @@ public UsersClientTests() _mockHttp = new MockHttpMessageHandler(); var services = new ServiceCollection(); - services.AddAppwriteServer(Constants.ProjectId, Constants.ApiKey, Constants.Endpoint, new RefitSettings + services.AddAppwriteServer(TestConstants.ProjectId, TestConstants.ApiKey, TestConstants.Endpoint, new RefitSettings { HttpMessageHandlerFactory = () => _mockHttp }); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Handlers/HeaderHandlerTests.cs b/tests/PinguApps.Appwrite.Server.Tests/Handlers/HeaderHandlerTests.cs index 07977a80..f7ec901b 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Handlers/HeaderHandlerTests.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Handlers/HeaderHandlerTests.cs @@ -21,7 +21,7 @@ public async Task SendAsync_AddsRequiredHeaders() .ReturnsAsync(new HttpResponseMessage()) .Verifiable(); - var config = new Config(Constants.Endpoint, Constants.ProjectId, Constants.ApiKey); + var config = new Config(TestConstants.Endpoint, TestConstants.ProjectId, TestConstants.ApiKey); var headerHandler = new HeaderHandler(config) { @@ -38,9 +38,9 @@ public async Task SendAsync_AddsRequiredHeaders() Times.Once(), ItExpr.Is(req => req.Headers.Contains("x-appwrite-project") && - req.Headers.GetValues("x-appwrite-project").Contains(Constants.ProjectId) && + req.Headers.GetValues("x-appwrite-project").Contains(TestConstants.ProjectId) && req.Headers.Contains("x-appwrite-key") && - req.Headers.GetValues("x-appwrite-key").Contains(Constants.ApiKey)), + req.Headers.GetValues("x-appwrite-key").Contains(TestConstants.ApiKey)), ItExpr.IsAny() ); } @@ -49,7 +49,7 @@ public async Task SendAsync_AddsRequiredHeaders() public void Constructor_ShouldThrowArgumentNullException_WhenApiKeyIsNull() { // Arrange - var config = new Config(Constants.Endpoint, Constants.ProjectId, null); + var config = new Config(TestConstants.Endpoint, TestConstants.ProjectId, null); // Act & Assert var exception = Assert.Throws(() => new HeaderHandler(config)); diff --git a/tests/PinguApps.Appwrite.Server.Tests/ServiceCollectionExtensionsTests.cs b/tests/PinguApps.Appwrite.Server.Tests/ServiceCollectionExtensionsTests.cs index 0cb4ccd2..d9548048 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/ServiceCollectionExtensionsTests.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/ServiceCollectionExtensionsTests.cs @@ -14,7 +14,7 @@ public void AddAppwriteServer_RegistersExpectedServices() var services = new ServiceCollection(); // Act - services.AddAppwriteServer(Constants.ProjectId, Constants.ApiKey, Constants.Endpoint); + services.AddAppwriteServer(TestConstants.ProjectId, TestConstants.ApiKey, TestConstants.Endpoint); // Assert var provider = services.BuildServiceProvider(); diff --git a/tests/PinguApps.Appwrite.Server.Tests/Utils/ResponseUtilsTests.cs b/tests/PinguApps.Appwrite.Server.Tests/Utils/ResponseUtilsTests.cs index 0cb55ad9..591cc8a3 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Utils/ResponseUtilsTests.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Utils/ResponseUtilsTests.cs @@ -25,7 +25,7 @@ public async Task GetApiResponse_Failure_ReturnsError() { var response = new HttpResponseMessage(HttpStatusCode.InternalServerError) { - Content = new StringContent(Constants.AppwriteError) + Content = new StringContent(TestConstants.AppwriteError) }; var exception = await ApiException.Create(new HttpRequestMessage(), HttpMethod.Get, response, new RefitSettings()); @@ -93,7 +93,7 @@ public async Task GenericGetApiResponse_Failure_ReturnsError() { var response = new HttpResponseMessage(HttpStatusCode.InternalServerError) { - Content = new StringContent(Constants.AppwriteError) + Content = new StringContent(TestConstants.AppwriteError) }; var exception = await ApiException.Create(new HttpRequestMessage(), HttpMethod.Get, response, new RefitSettings()); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Responses/IdentityListTests.cs b/tests/PinguApps.Appwrite.Shared.Tests/Responses/IdentityListTests.cs index 1373cb4d..e09431e0 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Responses/IdentityListTests.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/Responses/IdentityListTests.cs @@ -44,7 +44,7 @@ public void Constructor_AssignsPropertiesCorrectly() public void CanBeDeserialized_FromJson() { // Act - var identitiesList = JsonSerializer.Deserialize(Constants.IdentitiesListResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + var identitiesList = JsonSerializer.Deserialize(TestConstants.IdentitiesListResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); // Assert Assert.NotNull(identitiesList); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Responses/JwtTests.cs b/tests/PinguApps.Appwrite.Shared.Tests/Responses/JwtTests.cs index d6304518..366fe7c6 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Responses/JwtTests.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/Responses/JwtTests.cs @@ -21,7 +21,7 @@ public void Constructor_AssignsPropertiesCorrectly() public void CanBeDeserialized_FromJson() { // Act - var jwt = JsonSerializer.Deserialize(Constants.JwtResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + var jwt = JsonSerializer.Deserialize(TestConstants.JwtResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); // Assert Assert.NotNull(jwt); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Responses/LogsListTests.cs b/tests/PinguApps.Appwrite.Shared.Tests/Responses/LogsListTests.cs index 9d2896b2..ebfa1c6f 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Responses/LogsListTests.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/Responses/LogsListTests.cs @@ -67,7 +67,7 @@ public void Constructor_AssignsPropertiesCorrectly() public void CanBeDeserialized_FromJson() { // Act - var logsList = JsonSerializer.Deserialize(Constants.LogsListResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + var logsList = JsonSerializer.Deserialize(TestConstants.LogsListResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); // Assert Assert.NotNull(logsList); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Responses/MembershipListTests.cs b/tests/PinguApps.Appwrite.Shared.Tests/Responses/MembershipListTests.cs index 54e87fd5..63f2ea20 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Responses/MembershipListTests.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/Responses/MembershipListTests.cs @@ -51,7 +51,7 @@ public void Constructor_AssignsPropertiesCorrectly() public void CanBeDeserialized_FromJson() { // Act - var membershipsList = JsonSerializer.Deserialize(Constants.MembershipsListResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + var membershipsList = JsonSerializer.Deserialize(TestConstants.MembershipsListResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); // Assert Assert.NotNull(membershipsList); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaChallengeTests.cs b/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaChallengeTests.cs index aeb91b33..42b36b92 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaChallengeTests.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaChallengeTests.cs @@ -27,7 +27,7 @@ public void Constructor_AssignsPropertiesCorrectly() public void CanBeDeserialized_FromJson() { // Act - var mfaType = JsonSerializer.Deserialize(Constants.MfaChallengeResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + var mfaType = JsonSerializer.Deserialize(TestConstants.MfaChallengeResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); // Assert Assert.NotNull(mfaType); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaFactorsTests.cs b/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaFactorsTests.cs index 985f2566..48502979 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaFactorsTests.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaFactorsTests.cs @@ -23,7 +23,7 @@ public void Constructor_AssignsPropertiesCorrectly() public void CanBeDeserialized_FromJson() { // Act - var mfaFactors = JsonSerializer.Deserialize(Constants.MfaFactorsResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + var mfaFactors = JsonSerializer.Deserialize(TestConstants.MfaFactorsResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); // Assert Assert.NotNull(mfaFactors); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaRecoveryCodesTests.cs b/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaRecoveryCodesTests.cs index 5d3d99c0..04a02b54 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaRecoveryCodesTests.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaRecoveryCodesTests.cs @@ -22,7 +22,7 @@ public void Constructor_AssignsPropertiesCorrectly() public void CanBeDeserialized_FromJson() { // Act - var mfaFactors = JsonSerializer.Deserialize(Constants.MfaFactorsResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + var mfaFactors = JsonSerializer.Deserialize(TestConstants.MfaFactorsResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); // Assert Assert.NotNull(mfaFactors); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaTypeTests.cs b/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaTypeTests.cs index 491b1a45..74ef1ef1 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaTypeTests.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/Responses/MfaTypeTests.cs @@ -23,7 +23,7 @@ public void Constructor_AssignsPropertiesCorrectly() public void CanBeDeserialized_FromJson() { // Act - var mfaType = JsonSerializer.Deserialize(Constants.MfaTypeResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + var mfaType = JsonSerializer.Deserialize(TestConstants.MfaTypeResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); // Assert Assert.NotNull(mfaType); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Responses/SessionTests.cs b/tests/PinguApps.Appwrite.Shared.Tests/Responses/SessionTests.cs index a812d659..c2de1b81 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Responses/SessionTests.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/Responses/SessionTests.cs @@ -80,7 +80,7 @@ public void Constructor_AssignsPropertiesCorrectly() public void CanBeDeserialized_FromJson() { // Act - var session = JsonSerializer.Deserialize(Constants.SessionResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + var session = JsonSerializer.Deserialize(TestConstants.SessionResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); // Assert Assert.NotNull(session); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Responses/SessionsListTests.cs b/tests/PinguApps.Appwrite.Shared.Tests/Responses/SessionsListTests.cs index d974cb50..f1f1df9e 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Responses/SessionsListTests.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/Responses/SessionsListTests.cs @@ -88,7 +88,7 @@ public void Constructor_AssignsPropertiesCorrectly() public void CanBeDeserialized_FromJson() { // Act - var sessionsList = JsonSerializer.Deserialize(Constants.SessionsListResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + var sessionsList = JsonSerializer.Deserialize(TestConstants.SessionsListResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); // Assert Assert.NotNull(sessionsList); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Responses/TargetListTests.cs b/tests/PinguApps.Appwrite.Shared.Tests/Responses/TargetListTests.cs index 16687504..f4db8ff5 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Responses/TargetListTests.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/Responses/TargetListTests.cs @@ -42,7 +42,7 @@ public void Constructor_AssignsPropertiesCorrectly() public void CanBeDeserialized_FromJson() { // Act - var targetList = JsonSerializer.Deserialize(Constants.TargetListResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + var targetList = JsonSerializer.Deserialize(TestConstants.TargetListResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); // Assert Assert.NotNull(targetList); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Responses/TokenTests.cs b/tests/PinguApps.Appwrite.Shared.Tests/Responses/TokenTests.cs index 10781ff4..65537e18 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Responses/TokenTests.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/Responses/TokenTests.cs @@ -31,7 +31,7 @@ public void Constructor_AssignsPropertiesCorrectly() public void CanBeDeserialized_FromJson() { // Act - var token = JsonSerializer.Deserialize(Constants.TokenResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + var token = JsonSerializer.Deserialize(TestConstants.TokenResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); // Assert Assert.NotNull(token); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Responses/UserListTests.cs b/tests/PinguApps.Appwrite.Shared.Tests/Responses/UserListTests.cs index 7a6e09c0..debf4f59 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Responses/UserListTests.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/Responses/UserListTests.cs @@ -66,7 +66,7 @@ public void Constructor_AssignsPropertiesCorrectly() public void CanBeDeserialized_FromJson() { // Act - var usersList = JsonSerializer.Deserialize(Constants.UsersListResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + var usersList = JsonSerializer.Deserialize(TestConstants.UsersListResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); // Assert Assert.NotNull(usersList); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Responses/UserTests.cs b/tests/PinguApps.Appwrite.Shared.Tests/Responses/UserTests.cs index 7abc29e4..db0e4fe9 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Responses/UserTests.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/Responses/UserTests.cs @@ -56,7 +56,7 @@ public void Constructor_AssignsPropertiesCorrectly() public void CanBeDeserialized_FromJson() { // Act - var user = JsonSerializer.Deserialize(Constants.UserResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); + var user = JsonSerializer.Deserialize(TestConstants.UserResponse, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); // Assert Assert.NotNull(user); diff --git a/tests/PinguApps.Appwrite.Shared.Tests/Constants.cs b/tests/PinguApps.Appwrite.Shared.Tests/TestConstants.cs similarity index 99% rename from tests/PinguApps.Appwrite.Shared.Tests/Constants.cs rename to tests/PinguApps.Appwrite.Shared.Tests/TestConstants.cs index c9d38650..4b29c4ec 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/Constants.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/TestConstants.cs @@ -1,6 +1,6 @@ namespace PinguApps.Appwrite.Shared.Tests; -public static class Constants +public static class TestConstants { public const string Endpoint = "https://localhost:12345/v1"; From 47aa137c224c5c33fccfeb623214fb79f26d2b5a Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sat, 12 Oct 2024 20:58:17 +0100 Subject: [PATCH 2/5] Added user agent to both client and server --- .../ServiceCollectionExtensions.cs | 34 +++++++++++---- .../ServiceCollectionExtensions.cs | 42 ++++++++++++------- 2 files changed, 51 insertions(+), 25 deletions(-) diff --git a/src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs b/src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs index a7a5729e..2ec4fa24 100644 --- a/src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs +++ b/src/PinguApps.Appwrite.Client/ServiceCollectionExtensions.cs @@ -1,5 +1,6 @@ using System; using System.Net.Http; +using System.Runtime.InteropServices; using Microsoft.Extensions.DependencyInjection; using PinguApps.Appwrite.Client.Handlers; using PinguApps.Appwrite.Client.Internals; @@ -28,7 +29,7 @@ public static IServiceCollection AddAppwriteClient(this IServiceCollection servi services.AddTransient(); services.AddRefitClient(refitSettings) - .ConfigureHttpClient(x => x.BaseAddress = new Uri(endpoint)) + .ConfigureHttpClient(x => ConfigureHttpClient(x, endpoint)) .AddHttpMessageHandler() .AddHttpMessageHandler(); @@ -53,19 +54,34 @@ public static IServiceCollection AddAppwriteClientForServer(this IServiceCollect services.AddTransient(); services.AddRefitClient(refitSettings) - .ConfigureHttpClient(x => x.BaseAddress = new Uri(endpoint)) + .ConfigureHttpClient(x => ConfigureHttpClient(x, endpoint)) .AddHttpMessageHandler() - .ConfigurePrimaryHttpMessageHandler((handler, sp) => - { - if (handler is HttpClientHandler clientHandler) - { - clientHandler.UseCookies = false; - } - }); + .ConfigurePrimaryHttpMessageHandler(ConfigurePrimaryHttpMessageHandler); services.AddSingleton(); services.AddSingleton(); return services; } + + private static void ConfigurePrimaryHttpMessageHandler(HttpMessageHandler messageHandler, IServiceProvider serviceProvider) + { + if (messageHandler is HttpClientHandler clientHandler) + { + clientHandler.UseCookies = false; + } + } + + private static void ConfigureHttpClient(HttpClient client, string endpoint) + { + client.BaseAddress = new Uri(endpoint); + client.DefaultRequestHeaders.UserAgent.ParseAdd(BuildUserAgent()); + } + + public static string BuildUserAgent() + { + var dotnetVersion = RuntimeInformation.FrameworkDescription.Replace("Microsoft .NET", ".NET").Trim(); + + return $"PinguAppsAppwriteDotNetClientSdk/{Constants.Version} (.NET/{dotnetVersion}; {RuntimeInformation.OSDescription.Trim()})"; + } } diff --git a/src/PinguApps.Appwrite.Server/ServiceCollectionExtensions.cs b/src/PinguApps.Appwrite.Server/ServiceCollectionExtensions.cs index 138c5c5f..032e60a9 100644 --- a/src/PinguApps.Appwrite.Server/ServiceCollectionExtensions.cs +++ b/src/PinguApps.Appwrite.Server/ServiceCollectionExtensions.cs @@ -1,5 +1,6 @@ using System; using System.Net.Http; +using System.Runtime.InteropServices; using Microsoft.Extensions.DependencyInjection; using PinguApps.Appwrite.Server.Clients; using PinguApps.Appwrite.Server.Handlers; @@ -29,26 +30,14 @@ public static IServiceCollection AddAppwriteServer(this IServiceCollection servi services.AddTransient(); services.AddRefitClient(refitSettings) - .ConfigureHttpClient(x => x.BaseAddress = new Uri(endpoint)) + .ConfigureHttpClient(x => ConfigureHttpClient(x, endpoint)) .AddHttpMessageHandler() - .ConfigurePrimaryHttpMessageHandler((handler, sp) => - { - if (handler is HttpClientHandler clientHandler) - { - clientHandler.UseCookies = false; - } - }); + .ConfigurePrimaryHttpMessageHandler(ConfigurePrimaryHttpMessageHandler); services.AddRefitClient(refitSettings) - .ConfigureHttpClient(x => x.BaseAddress = new Uri(endpoint)) + .ConfigureHttpClient(x => ConfigureHttpClient(x, endpoint)) .AddHttpMessageHandler() - .ConfigurePrimaryHttpMessageHandler((handler, sp) => - { - if (handler is HttpClientHandler clientHandler) - { - clientHandler.UseCookies = false; - } - }); + .ConfigurePrimaryHttpMessageHandler(ConfigurePrimaryHttpMessageHandler); services.AddSingleton(); services.AddSingleton(); @@ -56,4 +45,25 @@ public static IServiceCollection AddAppwriteServer(this IServiceCollection servi return services; } + + private static void ConfigurePrimaryHttpMessageHandler(HttpMessageHandler messageHandler, IServiceProvider serviceProvider) + { + if (messageHandler is HttpClientHandler clientHandler) + { + clientHandler.UseCookies = false; + } + } + + private static void ConfigureHttpClient(HttpClient client, string endpoint) + { + client.BaseAddress = new Uri(endpoint); + client.DefaultRequestHeaders.UserAgent.ParseAdd(BuildUserAgent()); + } + + public static string BuildUserAgent() + { + var dotnetVersion = RuntimeInformation.FrameworkDescription.Replace("Microsoft .NET", ".NET").Trim(); + + return $"PinguAppsAppwriteDotNetServerSdk/{Constants.Version} (.NET/{dotnetVersion}; {RuntimeInformation.OSDescription.Trim()})"; + } } From 5d446c5667a7c95c1eb61d0b4a3a2319856ae589 Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sat, 12 Oct 2024 21:10:32 +0100 Subject: [PATCH 3/5] testing in app --- src/PinguApps.Appwrite.Playground/App.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/PinguApps.Appwrite.Playground/App.cs b/src/PinguApps.Appwrite.Playground/App.cs index 487eea2b..c7efba13 100644 --- a/src/PinguApps.Appwrite.Playground/App.cs +++ b/src/PinguApps.Appwrite.Playground/App.cs @@ -1,5 +1,5 @@ using Microsoft.Extensions.Configuration; -using PinguApps.Appwrite.Shared.Requests.Users; +using PinguApps.Appwrite.Shared.Requests.Account; namespace PinguApps.Appwrite.Playground; internal class App @@ -17,13 +17,13 @@ public App(Client.IAppwriteClient client, Server.Clients.IAppwriteClient server, public async Task Run(string[] args) { - var request = new UpdatePhoneVerificationRequest() + var request = new CreateSessionRequest() { UserId = "664aac1a00113f82e620", - PhoneVerification = true + Secret = "80af6605407a3918cd9bb1796b6bfdc5d4b2dc57dad4677432d902e8bef9ba6f" }; - var response = await _server.Users.UpdatePhoneVerification(request); + var response = await _client.Account.CreateSession(request); Console.WriteLine(response.Result.Match( result => result.ToString(), From 1e205bad602c366f77789ef430a62e90283b37d1 Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sat, 12 Oct 2024 21:14:55 +0100 Subject: [PATCH 4/5] Updated client and server to use the new Constants.Version so we can update it in a single place --- src/PinguApps.Appwrite.Client/Internals/IBaseApi.cs | 5 +++-- src/PinguApps.Appwrite.Server/Internals/IBaseApi.cs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/PinguApps.Appwrite.Client/Internals/IBaseApi.cs b/src/PinguApps.Appwrite.Client/Internals/IBaseApi.cs index 07c99bce..8e8e4d6f 100644 --- a/src/PinguApps.Appwrite.Client/Internals/IBaseApi.cs +++ b/src/PinguApps.Appwrite.Client/Internals/IBaseApi.cs @@ -1,4 +1,5 @@ -using Refit; +using PinguApps.Appwrite.Shared; +using Refit; namespace PinguApps.Appwrite.Client.Internals; @@ -6,7 +7,7 @@ namespace PinguApps.Appwrite.Client.Internals; "x-sdk-name: .NET", "x-sdk-platform: client", "x-sdk-language: dotnet", - "x-sdk-version: 0.0.1", + $"x-sdk-version: {Constants.Version}", "X-Appwrite-Response-Format: 1.6.0")] internal interface IBaseApi { diff --git a/src/PinguApps.Appwrite.Server/Internals/IBaseApi.cs b/src/PinguApps.Appwrite.Server/Internals/IBaseApi.cs index 525309dd..058a51c7 100644 --- a/src/PinguApps.Appwrite.Server/Internals/IBaseApi.cs +++ b/src/PinguApps.Appwrite.Server/Internals/IBaseApi.cs @@ -1,4 +1,5 @@ -using Refit; +using PinguApps.Appwrite.Shared; +using Refit; namespace PinguApps.Appwrite.Server.Internals; @@ -6,7 +7,7 @@ namespace PinguApps.Appwrite.Server.Internals; "x-sdk-name: .NET", "x-sdk-platform: server", "x-sdk-language: dotnet", - "x-sdk-version: 0.0.1", + $"x-sdk-version: {Constants.Version}", "X-Appwrite-Response-Format: 1.6.0")] internal interface IBaseApi { From 6aeee653644dada79cbb9c02dd9616aa2ecbc4e3 Mon Sep 17 00:00:00 2001 From: Matthew Parker Date: Sat, 12 Oct 2024 21:18:15 +0100 Subject: [PATCH 5/5] Fixed tests --- .../Clients/Account/AccountTestsExtensions.cs | 5 +++-- .../Clients/ClientTestsExtensions.cs | 5 +++-- tests/PinguApps.Appwrite.Shared.Tests/TestConstants.cs | 2 -- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountTestsExtensions.cs b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountTestsExtensions.cs index 6deab7c7..8338d4af 100644 --- a/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountTestsExtensions.cs +++ b/tests/PinguApps.Appwrite.Client.Tests/Clients/Account/AccountTestsExtensions.cs @@ -1,4 +1,5 @@ -using PinguApps.Appwrite.Shared.Tests; +using PinguApps.Appwrite.Shared; +using PinguApps.Appwrite.Shared.Tests; using RichardSzalay.MockHttp; namespace PinguApps.Appwrite.Client.Tests.Clients.Account; @@ -12,7 +13,7 @@ public static MockedRequest ExpectedHeaders(this MockedRequest request, bool add .WithHeaders("x-sdk-name", TestConstants.SdkName) .WithHeaders("x-sdk-platform", "client") .WithHeaders("x-sdk-language", TestConstants.SdkLanguage) - .WithHeaders("x-sdk-version", TestConstants.SdkVersion) + .WithHeaders("x-sdk-version", Constants.Version) .WithHeaders("x-appwrite-response-format", TestConstants.AppwriteResponseFormat); if (addSessionHeaders) diff --git a/tests/PinguApps.Appwrite.Server.Tests/Clients/ClientTestsExtensions.cs b/tests/PinguApps.Appwrite.Server.Tests/Clients/ClientTestsExtensions.cs index 654e1665..7a9b985c 100644 --- a/tests/PinguApps.Appwrite.Server.Tests/Clients/ClientTestsExtensions.cs +++ b/tests/PinguApps.Appwrite.Server.Tests/Clients/ClientTestsExtensions.cs @@ -1,4 +1,5 @@ -using PinguApps.Appwrite.Shared.Tests; +using PinguApps.Appwrite.Shared; +using PinguApps.Appwrite.Shared.Tests; using RichardSzalay.MockHttp; namespace PinguApps.Appwrite.Server.Tests.Clients; @@ -13,7 +14,7 @@ public static MockedRequest ExpectedHeaders(this MockedRequest request) .WithHeaders("x-sdk-name", TestConstants.SdkName) .WithHeaders("x-sdk-platform", "server") .WithHeaders("x-sdk-language", TestConstants.SdkLanguage) - .WithHeaders("x-sdk-version", TestConstants.SdkVersion) + .WithHeaders("x-sdk-version", Constants.Version) .WithHeaders("x-appwrite-response-format", TestConstants.AppwriteResponseFormat); } } diff --git a/tests/PinguApps.Appwrite.Shared.Tests/TestConstants.cs b/tests/PinguApps.Appwrite.Shared.Tests/TestConstants.cs index 4b29c4ec..211e52e6 100644 --- a/tests/PinguApps.Appwrite.Shared.Tests/TestConstants.cs +++ b/tests/PinguApps.Appwrite.Shared.Tests/TestConstants.cs @@ -16,8 +16,6 @@ public static class TestConstants public const string SdkLanguage = "dotnet"; - public const string SdkVersion = "0.0.1"; - public const string AppwriteResponseFormat = "1.6.0"; public const string AppwriteError = """