Example #1
0
        public void SrVmPickerItemCanBeEnabledChecksSrType(bool IsLunPerVdi)
        {
            Mock <SR> sr = ObjectManager.NewXenObject <SR>(id);

            sr.Setup(s => s.HBALunPerVDI()).Returns(IsLunPerVdi);
            sr.Setup(s => s.ShowInVDISRList(false)).Returns(true); //ShowHiddenVDIs == true

            //Below sets CanBeEnabled for the picker items to be true
            sr.Setup(s => s.IsBroken(false)).Returns(false);
            sr.Setup(s => s.CanBeSeenFrom(It.IsAny <Host>())).Returns(true);

            SrPickerLunPerVDIItem item = new SrPickerLunPerVDIItemNoImageCanBeEnabled(sr.Object);

            Assert.That(item.Show, Is.True);

            //Expect only one call to this method as the Unsupported SR call is overridden in SrPickerLunPerVDIItem
            //This one call coms from SrPickerLunPerVDIItem's CanBeEnabled
            sr.Verify(s => s.HBALunPerVDI(), Times.Once());
        }
        public void SrVmPickerItemCanBeEnabledChecksSrType(bool IsLunPerVdi)
        {
            Mock<SR> sr = ObjectManager.NewXenObject<SR>(id);
            sr.Setup(s => s.HBALunPerVDI).Returns(IsLunPerVdi);
            sr.Setup(s => s.ShowInVDISRList(false)).Returns(true); //ShowHiddenVDIs == true
            
            //Below sets CanBeEnabled for the picker items to be true
            sr.Setup(s => s.IsBroken(false)).Returns(false);
            sr.Setup(s => s.CanBeSeenFrom(It.IsAny<Host>())).Returns(true);

            SrPickerLunPerVDIItem item = new SrPickerLunPerVDIItemNoImageCanBeEnabled(sr.Object);
            Assert.That(item.Show, Is.True);

            //Expect only one call to this method as the Unsupported SR call is overridden in SrPickerLunPerVDIItem 
            //This one call coms from SrPickerLunPerVDIItem's CanBeEnabled
            sr.Verify(s => s.HBALunPerVDI, Times.Once());
        }