public void Constructor_Parse_CorrectCount() { var lines = LineWrapper.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); var wrappers = lines.Select(l => l.ToWrapper(Constants.DataObjectMap).Contents).ToArray(); var newText = string.Join("", wrappers); var parseResult = new ExtractParseResult(newText, Constants.DataObjectMap); var extract = parseResult.ToExtract(); var extractItems = parseResult.ToExtractItems(extract.ExtractId, Constants.DataObjectMap, Constants.RelationshipMap, Constants.MultiRelationshipMap); Assert.AreEqual(lines.Length - 2, extractItems.Count); }
public void GetPerson_PersonNotExists_Null( [ValueSource(typeof(Utilities), "RandomCprNumberStrings5")] string cprNumber) { var lines = LineWrapper.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); var wrappers = lines.Select(l => l.ToWrapper(Constants.DataObjectMap).Contents).ToArray(); var newText = string.Join("", wrappers); var parseResult = new ExtractParseResult(newText, Constants.DataObjectMap); var extract = parseResult.ToExtract("", true, 0); var extractItems = parseResult.ToExtractItems(extract.ExtractId, Constants.DataObjectMap, Constants.RelationshipMap, Constants.MultiRelationshipMap); extract.ExtractItems.AddRange(extractItems); var person = Extract.GetPersonFromLatestExtract(cprNumber, extract.ExtractItems.AsQueryable(), Constants.DataObjectMap); Assert.Null(person); }
public void Constructor_Parse_CorrectReconstruction() { var lines = LineWrapper.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); var wrappers = lines.Select(l => l.ToWrapper(Constants.DataObjectMap).Contents).ToArray(); var newText = string.Join("", wrappers); var parseResult = new ExtractParseResult(newText, Constants.DataObjectMap); var extract = parseResult.ToExtract(); var extractItems = parseResult.ToExtractItems(extract.ExtractId, Constants.DataObjectMap, Constants.RelationshipMap, Constants.MultiRelationshipMap); var result = extractItems.Select(i => i.Contents).ToList(); result.Insert(0, extract.StartRecord); result.Add(extract.EndRecord); for (int i = 0; i < lines.Length; i++) { Assert.AreEqual(wrappers[i], result[i]); } }
public void GetPerson_PersonExists_Correct( [Range(1, 1098, 20)] int lineNumber) { var lines = LineWrapper.ParseBatch(Properties.Resources.U12170_P_opgavenr_110901_ADRNVN_FE); var wrappers = lines.Select(l => l.ToWrapper(Constants.DataObjectMap).Contents).ToArray(); var newText = string.Join("", wrappers); var parseResult = new ExtractParseResult(newText, Constants.DataObjectMap); var extract = parseResult.ToExtract("", true, 0); var extractItems = parseResult.ToExtractItems(extract.ExtractId, Constants.DataObjectMap, Constants.RelationshipMap, Constants.MultiRelationshipMap); extract.ExtractItems.AddRange(extractItems); var pnr = lines[2].PNR; var person = Extract.GetPersonFromLatestExtract(pnr, extract.ExtractItems.AsQueryable(), Constants.DataObjectMap); Assert.NotNull(person); Assert.AreEqual(pnr, person.PersonInformation.PNR); }