From 5c523220cc4a3c2442b42ac5703d017abea20393 Mon Sep 17 00:00:00 2001 From: MichalFrends1 Date: Wed, 12 Jun 2024 08:45:40 +0200 Subject: [PATCH] Change of user and domain name for unit tests --- .../UnitTests.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Frends.Salesforce.Authenticate/Frends.Salesforce.Authenticate.Tests/UnitTests.cs b/Frends.Salesforce.Authenticate/Frends.Salesforce.Authenticate.Tests/UnitTests.cs index ee376cf..ef783b6 100644 --- a/Frends.Salesforce.Authenticate/Frends.Salesforce.Authenticate.Tests/UnitTests.cs +++ b/Frends.Salesforce.Authenticate/Frends.Salesforce.Authenticate.Tests/UnitTests.cs @@ -17,8 +17,8 @@ public class UnitTests private readonly string password = Environment.GetEnvironmentVariable("Salesforce_Password"); private readonly string securityToken = Environment.GetEnvironmentVariable("Salesforce_Security_Token"); private readonly string clientID = Environment.GetEnvironmentVariable("Salesforce_ClientID"); - private readonly string domain = @"https://hiqfinlandoy2-dev-ed.my.salesforce.com"; - private readonly string username = "testuser@test.fi"; + private readonly string domain = @"https://frends2-dev-ed.develop.my.salesforce.com"; + private readonly string username = "jefim+tasks@frends.com"; private readonly string authurl = @"https://login.salesforce.com/services/oauth2/token"; [AssemblyInitialize] @@ -49,7 +49,7 @@ public async Task Authenticate_ShouldReturnAccessToken_OnSuccess() } [TestMethod] - public async Task Authenticate_ShouldThrowAuthenticationException_OnInvalidCredentials() + public async Task Authenticate_ThrowOnInvalidCredentials() { var input = new Input { @@ -61,14 +61,17 @@ public async Task Authenticate_ShouldThrowAuthenticationException_OnInvalidCrede SecurityToken = "invalid_security_token", }; - await Assert.ThrowsExceptionAsync(() => Salesforce.Authenticate(input, CancellationToken.None)); + var exception = await Assert.ThrowsExceptionAsync( + () => Salesforce.Authenticate(input, CancellationToken.None)); + + Assert.IsTrue(exception.Message.Contains("Bad Request"), "The exception message did not contain 'Bad request'."); } [TestMethod] - public async Task Authenticate_ShouldThrowArgumentNullException_WhenCredentialsAreNull() + public async Task Authenticate_ThrowWhenCredentialsAreNull() { Input input = null; - await Assert.ThrowsExceptionAsync(() => Salesforce.Authenticate(input, CancellationToken.None)); + await Assert.ThrowsExceptionAsync(() => Salesforce.Authenticate(input, CancellationToken.None)); } [TestMethod]