public ProjectParser GetXmlParser(Options options) { var serviceBuilder = new ServiceBuilder(); serviceBuilder.Setup(options); serviceBuilder.Build(); var rootPath = GetRootPath(options); var parentFolder = GetParentFolder(options); var namingConvention = GetNamingConvention(options); var parser = new ProjectParser() { ParentFolder = parentFolder, RootPath = rootPath, NamingConvention = namingConvention }; var policyParser = new PolicyParser(serviceBuilder.GetPolicyService()); var dataSourceParser = new DataSourceParser(serviceBuilder.GetDataSourceService()); var reportParser = new ReportParser(serviceBuilder.GetReportService(), new[] { policyParser }); var folderParser = new FolderParser(serviceBuilder.GetFolderService(), new IParser[] { policyParser, dataSourceParser, reportParser }); parser.ChildParsers.Add(dataSourceParser); parser.ChildParsers.Add(reportParser); parser.ChildParsers.Add(folderParser); return(parser); }
private void FinishDownload(EventArgs e) { PolicyParser dataClass = new PolicyParser(); string brutPolicies = policies.GetData(); dataClass.CustomItemRegex(brutPolicies); Debug.WriteLine("Finished"); //consoleOutput.Text = dataClass.GetJson(); Dictionary <string, string> items = dataClass.GetListOfItems(); Debug.WriteLine("Pidor" + items.Count); foreach (KeyValuePair <string, string> element in items) { int i = 0; ElementsListBox.Items.Insert(i, element.Key); i++; } }
public void ParseCorrectRole() { var mock = new Mock <PolicyService>(); mock.Setup(s => s.Create(It.IsAny <string>(), It.IsAny <IEnumerable <Tuple <string, string[]> > >(), It.IsAny <bool>())).Verifiable(); var service = mock.Object; var parser = new PolicyParser(service); var xmlDoc = new XmlDocument(); using (Stream stream = Assembly.GetExecutingAssembly() .GetManifestResourceStream("RsPackage.Testing.Resources.BasicSample.xml")) using (StreamReader reader = new StreamReader(stream)) xmlDoc.Load(reader); var root = xmlDoc.FirstChild.NextSibling.SelectSingleNode("./Report[@Name='Team sales']"); parser.Execute(root); Mock.Get(service).Verify(s => s.Create(It.IsAny <string>(), It.Is <IEnumerable <Tuple <string, string[]> > >(r => r.ElementAt(0).Item1 == "Browser"), It.IsAny <bool>()), Times.Once); }
public static SledRentalPasswordPolicy Create(string policy) { var(min, max, ch) = PolicyParser.Parse(policy); return(new SledRentalPasswordPolicy(min, max, ch)); }