public static string Execute(string vri, int type, INodesCollection mf) { var pattern = @"\d+[.]\d+([.]\d+)?([.]\d+)?"; var matches = Regex.Matches(vri, pattern).Cast <Match>().Select(p => p.Value); Codes codes = new Codes(mf); foreach (var match in matches) { if (map.ContainsKey(match)) { if (match.Equals("12.0.1") && type == 500) { codes.AddNodes(match); } else if (match.Equals("12.0.2") && type == 400) { codes.AddNodes(match); } else { codes.AddNodes(map[match]); } } else { codes.AddNodes(match); } } codes.Sort(); codes.Distinct(); return(codes.Show); }
public static string Execute540(string vri, INodesCollection mf) { var lmap = new List <(string, string)>(); foreach (var kv in map) { lmap.Add((kv.Key.Substring(0, kv.Key.Length - 2), kv.Value)); } var pattern = @"\d+[.]\d+([.]\d+)?([.]\d+)?"; var matches = Regex.Matches(vri, pattern).Cast <Match>().Select(p => p.Value); var result = ""; foreach (var match in matches) { foreach (var val in lmap) { if (match.Equals(val.Item1)) { result += result.Length == 0? val.Item2 : ", " + val.Item2; } } } Codes codes = new Codes(mf); codes.AddNodes(result); codes.Sort(); codes.Distinct(); return(codes.Show); }
public ICodeHandler Handler(string vri, IBTI bti, string input) { ICodes codes = new Codes(mf); codes.AddNodes(vri); return(new CodeHandler(codes, bti, input, 0, mf)); }
public string exceptedCodes(string vri) { ICodes excepted = new Codes(mf); excepted.AddNodes(vri); return(excepted.Show); }
public ITypeAndKind Maker(string vri) { ICodes codes = new Codes(mf); codes.AddNodes(vri); ITypeAndKind type = new TypeAndKind(codes); return(type); }
public void RevmoveAll_StringInput_CorrectRemove(string codesVri, string codesRem, string expected) { ICodes codes = new Codes(mf); codes.AddNodes(codesVri); codes.RemoveAll(codesRem); Assert.AreEqual(expected, codes.Show); }
public void Sort_unSortedList_toSortedResult(string unsortedCodes, string sortedCodes) { ICodes codes = new Codes(mf); codes.AddNodes(unsortedCodes); codes.Sort(); Assert.AreEqual(codes.Show, sortedCodes); }
public void Except_NotEmptyArgument_correctResult(string vri, string result, string except) { ICodes codes = new Codes(mf); codes.AddNodes(vri); var q = codes; var res = q.Except(except); Assert.AreEqual(result, res); }
public void ExistsType_StringInput_CorrectResult(string input, string types) { ICodes codes = new Codes(mf); codes.AddNodes(input); var result = codes; var res = result.ExistsType(types); Assert.AreEqual(res, true); }
public void GasPipeline_areaMoreThan300_returnPipeLineIndex(string vri, string excepted) { ICodes codes = new Codes(mf); codes.AddNodes(vri); var result = exceptedCodes(excepted); ICodeHandler processing = new CodeHandler(codes, new BTI(), "", 350, mf); processing.FullProcessing(); Assert.AreEqual(result, processing.Codes.Show); }
public void FixCode_Other_NotASingleOtherCode_RetunsCodesWithoutOther() { IBTI buildings = new BTI("2.6.0", false, false, true); ICodes Codes = new Codes(mf); Codes.AddNodes("4.9.0, 12.3.0"); ICodeHandler processing = new CodeHandler(Codes, buildings, "", 0, mf); var result = exceptedCodes("4.9.0"); processing.FullProcessing(); Assert.AreEqual(result, Codes.Show); }
public void FederalType230Fix_Type300NotFromAList_ReturnsType230() { ICodes codes = new Codes(mf); codes.AddNodes("2.5, 6.4"); var handler = new CodeHandler(codes, new BTI(), "", 0, mf); var types = new TypeAndKind(codes); handler.Cutter += types.CutterDelegate; handler.IsFederalEventHandler(); handler.FullProcessing(); Assert.AreEqual(230, types.Type); }
public void FederalSpeciallyProtectedAreaFix_Codes9_1And9_3AndOtherTypes_ReturnsOtherTypes() { ICodes codes = new Codes(mf); codes.AddNodes("4.5, 9.1, 9.3"); var handler = new CodeHandler(codes, new BTI(), "", 0, mf); var types = new TypeAndKind(codes); handler.Cutter += types.CutterDelegate; handler.IsFederalEventHandler(); handler.FullProcessing(); Assert.AreEqual(100, types.Type); Assert.AreEqual("4.5, 9.1, 9.3", codes.Show); }