Skip to content

Commit

Permalink
Add enum integrity tests and new build config file
Browse files Browse the repository at this point in the history
Updated PolicyTests.cs to include additional namespaces and
added new test methods to verify the integrity of various enums
by comparing their hashes to expected values. Introduced a new
configuration file, AWSSDK.NetFramework.lutconfig, to specify
build and test settings, including enabling parallel builds and
setting a test case timeout.
  • Loading branch information
paulomorgado committed Sep 14, 2024
1 parent cf56696 commit e83ff12
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions sdk/test/UnitTests/Custom/PolicyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

using Amazon.Auth.AccessControlPolicy;
using AWSSDK_DotNet.IntegrationTests.Utils;
using static Amazon.Auth.AccessControlPolicy.ConditionFactory;

namespace AWSSDK_DotNet.UnitTests
{
Expand Down Expand Up @@ -102,5 +104,55 @@ public void CheckIfStatementExists_DoesCaseInsensitiveComparisonOnActions()

Assert.IsTrue(result);
}

[TestMethod]
public void LookForArnComparisonTypeChanges()
{
var expectedHash = "93F200C066AF797AE2A923313D16DD1737AB26D8041C03F68E2BC9FAB03F464A";
AssertExtensions.AssertEnumUnchanged(
typeof(ArnComparisonType),
expectedHash,
"The Amazon.Auth.AccessControlPolicy.ConditionFactory.ToString(ArnComparisonType) method implementation may need to be updated.");
}

[TestMethod]
public void LookForDateComparisonTypeChanges()
{
var expectedHash = "929F27F8B4A0619A30D90F35429690BE334B14D4881EF47311FDEB5696D27DEF";
AssertExtensions.AssertEnumUnchanged(
typeof(DateComparisonType),
expectedHash,
"The Amazon.Auth.AccessControlPolicy.ConditionFactory.ToString(DateComparisonType) method implementation may need to be updated.");
}

[TestMethod]
public void LookForIpAddressComparisonTypeChanges()
{
var expectedHash = "440711FCA8408753BAEC4D1ECA39F813477A43DCA988924E0260A28359F53B78";
AssertExtensions.AssertEnumUnchanged(
typeof(IpAddressComparisonType),
expectedHash,
"The Amazon.Auth.AccessControlPolicy.ConditionFactory.ToString(DateComparisonType) method implementation may need to be updated.");
}

[TestMethod]
public void LookForNumericComparisonTypeChanges()
{
var expectedHash = "15808022DE81B0A1C62DBB9238EA542B891EDE6840278508C1FBFC4A6ACC829D";
AssertExtensions.AssertEnumUnchanged(
typeof(NumericComparisonType),
expectedHash,
"The Amazon.Auth.AccessControlPolicy.ConditionFactory.ToString(DateComparisonType) method implementation may need to be updated.");
}

[TestMethod]
public void LookForStringComparisonTypeChanges()
{
var expectedHash = "8466438D83763A3ADE2161964A9C3A68E247BC576A40956D5295382C74D8FB22";
AssertExtensions.AssertEnumUnchanged(
typeof(StringComparisonType),
expectedHash,
"The Amazon.Auth.AccessControlPolicy.ConditionFactory.ToString(DateComparisonType) method implementation may need to be updated.");
}
}
}

0 comments on commit e83ff12

Please sign in to comment.