mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CA-220040: Fix for unit tests
Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
parent
b12f488ffd
commit
7d4524196b
@ -69,11 +69,17 @@ namespace XenAdminTests.WizardTests
|
||||
private Mock<Pool_patch> SetupBuilder(after_apply_guidance guidance, out string msg, out Mock<Host> host)
|
||||
{
|
||||
Mock<Pool_patch> patch = ObjectManager.NewXenObject<Pool_patch>(id);
|
||||
|
||||
host = ObjectManager.NewXenObject<Host>(id);
|
||||
host.Setup(h => h.IsMaster()).Returns(true);
|
||||
host.Setup(h => h.Name).Returns("MyHost");
|
||||
host.Setup(h => h.uuid).Returns("MyHostUUID");
|
||||
|
||||
if (guidance == after_apply_guidance.restartHost)
|
||||
host.Setup(h => h.uuid).Returns("MyHostUUID");
|
||||
|
||||
host.Setup(h => h.patches).Returns(new List<XenRef<Host_patch>>());
|
||||
patch.Setup(p => p.after_apply_guidance).Returns(new List<after_apply_guidance> { guidance });
|
||||
|
||||
msg = PatchingWizardModeGuidanceBuilder.ModeRetailPatch(new List<Host> { host.Object }, patch.Object, new Dictionary<string,LivePatchCode>());
|
||||
return patch;
|
||||
}
|
||||
|
@ -92,12 +92,17 @@ namespace XenAPI
|
||||
|
||||
public DateTime AppliedOn(Host host)
|
||||
{
|
||||
foreach (Host_patch hostPatch in host.Connection.ResolveAll(host.patches))
|
||||
{
|
||||
Pool_patch patch = host.Connection.Resolve(hostPatch.pool_patch);
|
||||
var hostPatches = host.Connection.ResolveAll(host.patches);
|
||||
|
||||
if (patch != null && string.Equals(patch.uuid, uuid, StringComparison.OrdinalIgnoreCase))
|
||||
return hostPatch.timestamp_applied;
|
||||
if (hostPatches != null)
|
||||
{
|
||||
foreach (Host_patch hostPatch in hostPatches)
|
||||
{
|
||||
Pool_patch patch = host.Connection.Resolve(hostPatch.pool_patch);
|
||||
|
||||
if (patch != null && string.Equals(patch.uuid, uuid, StringComparison.OrdinalIgnoreCase))
|
||||
return hostPatch.timestamp_applied;
|
||||
}
|
||||
}
|
||||
|
||||
return DateTime.MaxValue;
|
||||
|
Loading…
Reference in New Issue
Block a user