private static CheckResult CheckDataIfStartMenuIsExpectedToNotExist(ICollection<FileChange> fileChanges, ICollection<Registryhange> registryChanges,
            FileChange fileChange, StartMenuData startMenuData, Registryhange registryChange)
        {
            if (fileChange == null)
            {
               return CheckResult.Succeeded(startMenuData);
            }

            if (fileChange.Type != FileChangeType.Delete)
            {
                fileChanges.Remove(fileChange);
                if (registryChange != null)
                {
                    registryChanges.Remove(registryChange);
                }
                return CheckResult.Failure("Found menu item:'" + startMenuData.Name + "' when is was not expected");
            }

            // When uninstalling this key get changed
            const string startPageKey = @"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartPage";
            var uninstallStartMenuKey =
                registryChanges.FirstOrDefault(x => string.Equals(x.Key, startPageKey, StringComparison.InvariantCultureIgnoreCase) &&
                                                    x.ValueName == "FavoritesRemovedChanges" &&
                                                    x.Type == RegistryChangeType.SetValue);

            if (uninstallStartMenuKey == null)
            {
                fileChanges.Remove(fileChange);
                return CheckResult.Failure("");
            }

            registryChanges.Remove(uninstallStartMenuKey);
            fileChanges.Remove(fileChange);
            return CheckResult.Succeeded(startMenuData);
        }
        public override ICollection<BaseTestData> ExtractData(XElement xmlNode, ICollection<DataProperty> properties)
        {
            var result = new Collection<BaseTestData>();
            var allowedAttributeNames = new Collection<string> { "name", "allusers" };

            foreach (var node in xmlNode.Descendants().Where(x => string.Equals(x.Name.LocalName, this.ElementName, StringComparison.InvariantCultureIgnoreCase)))
            {
                CheckForAdditionalAttributes(node, allowedAttributeNames);
                var data = new StartMenuData
                {
                    Name = XmlTools.GetNamedAttributeValue(node, "name", string.Empty),
                    AllUsers = bool.Parse(XmlTools.GetNamedAttributeValue(node, "allusers", string.Empty))
                };

                AddCommonData(node, data, properties);
                result.Add(data);
            }

            return result;
        }
        private static CheckResult CheckDataIfStartMenuIsExpectedToExist(ICollection<FileChange> fileChanges, ICollection<Registryhange> registryChanges,
            FileChange fileChange, StartMenuData startMenuData, Registryhange registryChange)
        {
            if (fileChange == null)
            {
                return CheckResult.Failure("Could not find start menu item:'" + startMenuData.Name + "'");
            }

            if (fileChange.Type == FileChangeType.Delete)
            {
                fileChanges.Remove(fileChange);
                return CheckResult.Failure("Could not find start menu item:'" + startMenuData.Name + "'");
            }

            if (registryChange == null)
            {
                fileChanges.Remove(fileChange);
                return CheckResult.Failure("Could not find start menu item:'" + startMenuData.Name + "'");
            }

            fileChanges.Remove(fileChange);
            registryChanges.Remove(registryChange);
            return CheckResult.Succeeded(startMenuData);
        }
 private bool Equals(StartMenuData other)
 {
     return string.Equals(Name, other.Name) && AllUsers == other.AllUsers;
 }