public void TestVirtStatusIs(string filter, string[] expectedVmNames)
        {
            var dict = PropertyAccessors.Geti18nFor(PropertyNames.virtualisation_status) as Dictionary <string, VM.VirtualisationStatus>;

            Assert.NotNull(dict, "Did not find i18n for VM.VirtualisationStatus");
            Assert.IsTrue(dict.TryGetValue(filter, out var status), $"Did not find i18n for {filter}");

            var query = new EnumPropertyQuery <VM.VirtualisationStatus>(PropertyNames.virtualisation_status, status, true);

            CheckMatch(query, expectedVmNames);
        }
Exemplo n.º 2
0
        protected override SearchForCustom NewDialog()
        {
            // Setup copied from SearchFor.InitializeDictionaries()
            Dictionary <ObjectTypes, String> typeNames = new Dictionary <ObjectTypes, String>();
            Dictionary <String, ObjectTypes> dict      = (Dictionary <String, ObjectTypes>)PropertyAccessors.Geti18nFor(PropertyNames.type);

            foreach (KeyValuePair <String, ObjectTypes> kvp in dict)
            {
                typeNames[kvp.Value] = kvp.Key;
            }
            return(new SearchForCustom(typeNames, ObjectTypes.Server | ObjectTypes.VM));
        }
Exemplo n.º 3
0
        private void InitializeDictionaries()
        {
            // add all single types, names and images
            Dictionary <String, ObjectTypes> dict   = (Dictionary <String, ObjectTypes>)PropertyAccessors.Geti18nFor(PropertyNames.type);
            ImageDelegate <ObjectTypes>      images = (ImageDelegate <ObjectTypes>)PropertyAccessors.GetImagesFor(PropertyNames.type);

            foreach (KeyValuePair <String, ObjectTypes> kvp in dict)
            {
                typeNames[kvp.Value]  = kvp.Key;
                typeImages[kvp.Value] = Images.GetImage16For(images(kvp.Value));
            }

            // add all combo types, mostly names only
            typeNames[ObjectTypes.LocalSR | ObjectTypes.RemoteSR]  = Messages.ALL_SRS;
            typeImages[ObjectTypes.LocalSR | ObjectTypes.RemoteSR] = Images.GetImage16For(images(ObjectTypes.LocalSR | ObjectTypes.RemoteSR));
            typeNames[ObjectTypes.Server | ObjectTypes.DisconnectedServer | ObjectTypes.VM] = Messages.SERVERS_AND_VMS;
            typeNames[ObjectTypes.Server | ObjectTypes.DisconnectedServer | ObjectTypes.VM | ObjectTypes.UserTemplate | ObjectTypes.RemoteSR] = Messages.SERVERS_AND_VMS_AND_CUSTOM_TEMPLATES_AND_REMOTE_SRS;
            typeNames[ObjectTypes.Server | ObjectTypes.DisconnectedServer | ObjectTypes.VM | ObjectTypes.UserTemplate | ObjectTypes.RemoteSR | ObjectTypes.LocalSR] = Messages.SERVERS_AND_VMS_AND_CUSTOM_TEMPLATES_AND_ALL_SRS;
            typeNames[ObjectTypes.AllExcFolders] = Messages.ALL_TYPES;
            typeNames[ObjectTypes.AllIncFolders] = Messages.ALL_TYPES_AND_FOLDERS;
            //typeNames[ObjectTypes.DockerContainer] = "Docker containers";
        }