public bool IsValidForMapping(bool lunPerVDI)
 {
     Mock<SR> sr = ObjectManager.NewXenObject<SR>(id);
     sr.Setup(s => s.HBALunPerVDI).Returns(lunPerVDI);
     Mock<VDI> vdi = ObjectManager.NewXenObject<VDI>(id);
     LunPerVdiPickerItem item = new LunPerVdiPickerItem(sr.Object, vdi.Object);
     return item.IsValidForMapping;
 }
示例#2
0
        public override bool Equals(object obj)
        {
            LunPerVdiPickerItem cf = obj as LunPerVdiPickerItem;

            if (cf == null)
            {
                return(false);
            }

            if (Vdi == null || cf.Vdi == null)
            {
                return(VdiColumnText.Equals(cf.VdiColumnText));
            }

            if (!String.IsNullOrEmpty(Vdi.opaque_ref) && !String.IsNullOrEmpty(cf.Vdi.opaque_ref))
            {
                return(Vdi.Equals(cf.Vdi));
            }

            return(VdiColumnText.Equals(cf.VdiColumnText));
        }
 public void NullSrIsValidForMapping()
 {
     Mock<VDI> vdi = ObjectManager.NewXenObject<VDI>(id);
     LunPerVdiPickerItem item = new LunPerVdiPickerItem(null, vdi.Object);
     Assert.That(item.IsValidForMapping, Is.False);
 }
        public void VdiBaseEqualsIsCalled()
        {
            Mock<VDI> vdiA = ObjectManager.NewXenObject<VDI>(id);
            vdiA.Object.opaque_ref = "OREF1";
            LunPerVdiPickerItem itemA = new LunPerVdiPickerItem(null, vdiA.Object);

            Mock<VDI> vdiB = ObjectManager.NewXenObject<VDI>(id);
            vdiB.Object.opaque_ref = "OREF2";
            LunPerVdiPickerItem itemB = new LunPerVdiPickerItem(null, vdiB.Object);

            Assert.That(itemB.Equals(itemA), Is.False);

        }
 public void NullVdiInBaseObjectEquals()
 {
     LunPerVdiPickerItem nullItem = new LunPerVdiPickerItem(null, null);
     Mock<VDI> vdiA = ObjectManager.NewXenObject<VDI>(id);
     LunPerVdiPickerItem item = new LunPerVdiPickerItem(null, vdiA.Object);
     Assert.That(nullItem.Equals(item), Is.False);
 }
 public void NullVdiInComparisonObjectEquals()
 {
     LunPerVdiPickerItem nullItem = new LunPerVdiPickerItem(null, null);
     Mock<VDI> vdi = ObjectManager.NewXenObject<VDI>(id);
     vdi.Setup(v => v.Name).Returns("NAME");
     LunPerVdiPickerItem item = new LunPerVdiPickerItem(null, vdi.Object);
     Assert.That(item.Equals(nullItem), Is.False);
     vdi.VerifyGet(v=>v.Name);
 }
 public void NullEqualsReturnsFalse()
 {
     LunPerVdiPickerItem item = new LunPerVdiPickerItem(null, null);
     Assert.That(item.Equals(null), Is.False);
 }