This repository has been archived by the owner on Jan 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
W-5871581 Fix stack key property usage in ETClient's constructor (#68)
* Revert back to the way the Stack key was determined from the SOAP endpoint. Moved the logic to parse the SOAP endpoint in the Stack property getter - exception will occur only if the Stack property is used. Added unit tests. * Version patch increase * Removed not needed test after stack key refactoring. * Removed not needed using.
- Loading branch information
1 parent
6b4c2f4
commit 65ebaea
Showing
5 changed files
with
53 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
using NUnit.Framework; | ||
using System; | ||
using System.Linq; | ||
|
||
namespace FuelSDK.Test | ||
{ | ||
[TestFixture] | ||
public class StackKeyTest | ||
{ | ||
private const string StackKeyErrorMessage = "Tenant specific endpoints doesn't support Stack Key property and this will property will be deprecated in next major release"; | ||
|
||
[Test] | ||
public void ExceptionOccursIfTSEFormatIsUsedForSoapEndpoint() | ||
{ | ||
var client = new ETClient(); | ||
|
||
var exception = Assert.Throws<Exception>( | ||
() => { var stack = client.Stack; } | ||
); | ||
|
||
Assert.That(exception.Message, Is.EqualTo(StackKeyErrorMessage)); | ||
} | ||
|
||
[Test] | ||
public void MultipleETClientInstancesForTheSameClientIdAndSecretWillHaveTheSameStackKey() | ||
public void StackPropertyIsMarkedAsObsolete() | ||
{ | ||
ETClient client1 = new ETClient(); | ||
ETClient client2 = new ETClient(); | ||
var type = typeof(ETClient); | ||
var obsoleteAttributes = (ObsoleteAttribute[])type.GetProperty("Stack").GetCustomAttributes(typeof(ObsoleteAttribute), false); | ||
|
||
Assert.IsNotNull(client1.Stack); | ||
Assert.IsNotNull(client2.Stack); | ||
Assert.AreEqual(client1.Stack, client2.Stack); | ||
Assert.AreEqual(1, obsoleteAttributes.Length); | ||
Assert.AreEqual(StackKeyErrorMessage, obsoleteAttributes[0].Message); | ||
Assert.AreEqual(false, obsoleteAttributes[0].IsError); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters