CP-6083: Updated test. Prevent potential NullReferenceException.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2013-09-20 14:33:23 +01:00
parent 8ae4eaa060
commit 89fa1950a4
3 changed files with 4 additions and 3 deletions

View File

@ -83,7 +83,7 @@ namespace XenAdminTests.UnitTests.UnitTestHelper.MockObjectBuilders
ObjectManager.MockProxyFor(id).Setup(
p =>
p.async_vgpu_create(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), "0",
It.IsAny<object>())).Returns(new Response<string>("ok"));
It.IsAny<object>(), It.IsAny<string>())).Returns(new Response<string>("ok"));
return new GpuAssignAction(vm.Object, group.Object, null);
}
}

View File

@ -48,7 +48,7 @@ namespace XenAdminTests.XenModelTests.ActionTests
protected override bool VerifyResult(GpuAssignAction action)
{
ObjectManager.MockProxyFor(id).Verify(p => p.async_vgpu_create(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), "0",
It.IsAny<object>()), Times.Once());
It.IsAny<object>(), It.IsAny<string>()), Times.Once());
ObjectManager.MockProxyFor(id).Verify(p => p.async_vgpu_destroy(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
return true;
}

View File

@ -69,7 +69,8 @@ namespace XenAdmin.Actions
if (Helpers.FeatureForbidden(vm, Host.RestrictVgpu))
VGPU.async_create(Session, vm.opaque_ref, gpu_group.opaque_ref, device, other_config);
else
VGPU.async_create(Session, vm.opaque_ref, gpu_group.opaque_ref, device, other_config, vgpuType.opaque_ref);
VGPU.async_create(Session, vm.opaque_ref, gpu_group.opaque_ref, device,
other_config, vgpuType == null ? null : vgpuType.opaque_ref);
}
}
}