mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
Update alert test fixes (#2953)
* CP-31587 made checksum comparison case insensitive as well as culture insensative Signed-off-by: Christophe25 <christopher.lancaste1@citrix.com> * Fixes not null assertion Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com> * Merges internal classes to be in same file Signed-off-by: Chris Lancaster <Christopher.Lancaste1@citrix.com>
This commit is contained in:
parent
99452959c3
commit
59e45f40c6
@ -33,6 +33,7 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using XenAdmin.Alerts;
|
||||
|
||||
namespace XenAdminTests
|
||||
{
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
namespace XenAdminTests.UnitTests.AlertTests
|
||||
{
|
||||
internal struct AlertClassUnitTestData
|
||||
internal class AlertClassUnitTestData
|
||||
{
|
||||
public string AppliesTo;
|
||||
public string Description;
|
||||
@ -40,6 +40,10 @@ namespace XenAdminTests.UnitTests.AlertTests
|
||||
public string HelpLinkText;
|
||||
public string Title;
|
||||
public string Priority;
|
||||
}
|
||||
|
||||
internal class UpdateAlertClassUnitTestData : AlertClassUnitTestData
|
||||
{
|
||||
public string Checksum;
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace XenAdminTests.UnitTests.AlertTests
|
||||
new DateTime(2011, 12, 09).ToString(), "abcde");
|
||||
|
||||
ClassVerifiers.VerifyGetters(new ClientUpdateAlert(version),
|
||||
new AlertClassUnitTestData
|
||||
new UpdateAlertClassUnitTestData
|
||||
{
|
||||
AppliesTo = BrandManager.BrandConsole,
|
||||
FixLinkText = "Go to Web Page",
|
||||
|
@ -218,7 +218,7 @@ namespace XenAdmin.Actions
|
||||
calculatedChecksum = string.Join("", hash.Select(b => $"{b:x2}"));
|
||||
|
||||
// Check if calculatedChecksum matches what is in chcupdates.xml
|
||||
if (checksum.ToLower() != calculatedChecksum.ToLower())
|
||||
if (!checksum.Equals(calculatedChecksum, StringComparison.InvariantCultureIgnoreCase))
|
||||
throw new Exception(Messages.UPDATE_CLIENT_INVALID_CHECKSUM );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user