Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<PackageReference Include="Autofac" Version="8.2.0" />
<PackageReference Include="CsvHelper" Version="33.0.1" />
<PackageReference Include="GlobalPhone" Version="6.0.1" />
<!-- GlobalPhone is compiled against PhoneNumbers 8.10.1.0 but its package only pulls libphonenumber-csharp 8.10.0
(assembly 8.10.0.0), which .NET refuses to bind: every parse threw and every number came back invalid. Do not remove. -->
<PackageReference Include="libphonenumber-csharp" Version="9.0.40" />
<PackageReference Include="RestSharp" Version="112.1.0" />
<PackageReference Include="Twilio" Version="7.9.1" />
</ItemGroup>
Expand Down
27 changes: 27 additions & 0 deletions Tests/Resgrid.Tests/Providers/PhoneNumberLibraryBindingTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Linq;
using FluentAssertions;
using NUnit.Framework;

namespace Resgrid.Tests.Providers
{
/// <summary>
/// GlobalPhone is compiled against a specific PhoneNumbers assembly version. When the restore graph resolves an older
/// one, the web and worker hosts cannot load it: every parse throws, PhoneNumberProcesserProvider swallows the
/// exception, and every phone number (a valid +1 number included) is reported invalid — which blocks every profile
/// save that carries a phone number. NUnit loads test assemblies with a lenient resolver, so the parsing tests pass
/// either way; this compares the versions directly.
/// </summary>
[TestFixture]
public class PhoneNumberLibraryBindingTests
{
[Test]
public void Resolved_PhoneNumbers_assembly_satisfies_GlobalPhone_reference()
{
var required = typeof(GlobalPhone.GlobalPhone).Assembly.GetReferencedAssemblies()
.Single(a => a.Name == "PhoneNumbers").Version;
var resolved = typeof(PhoneNumbers.PhoneNumberUtil).Assembly.GetName().Version;

resolved.Should().BeGreaterThanOrEqualTo(required);
Comment on lines +22 to +24

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

Assembly-binding validation allows an incompatible PhoneNumbers version, so provider parse calls can fail when the resolved assembly is 9.0.40.0 while GlobalPhone references 8.10.1.0, allowing this test to pass while profile saves reject valid phone numbers. Assert the exact assembly identity required by GlobalPhone or exercise an actual GlobalPhone parse under the production host binding, then select a package/build or binding configuration that satisfies that identity.

var resolvedAssembly = typeof(PhoneNumbers.PhoneNumberUtil).Assembly.GetName();\nresolvedAssembly.Name.Should().Be("PhoneNumbers");\nresolvedAssembly.Version.Should().Be(required);
Prompt for LLM

File Tests/Resgrid.Tests/Providers/PhoneNumberLibraryBindingTests.cs:

Line 22 to 24:

Assembly-binding validation allows an incompatible PhoneNumbers version, so provider parse calls can fail when the resolved assembly is 9.0.40.0 while GlobalPhone references 8.10.1.0, allowing this test to pass while profile saves reject valid phone numbers. Assert the exact assembly identity required by GlobalPhone or exercise an actual GlobalPhone parse under the production host binding, then select a package/build or binding configuration that satisfies that identity.

Suggested Code:

var resolvedAssembly = typeof(PhoneNumbers.PhoneNumberUtil).Assembly.GetName();\nresolvedAssembly.Name.Should().Be("PhoneNumbers");\nresolvedAssembly.Version.Should().Be(required);

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

}
}
}
Loading
Loading