public List <UTInfo> Export(string fullFileName) { var rootUtInfo = new UTInfo(fullFileName); using (var streamReader = new StreamReader(fullFileName)) { bool isFact = false; bool isParameterized = false; while (!streamReader.EndOfStream) { string currentLine = streamReader.ReadLine(); if (currentLine.IsComment() || !currentLine.IsUsefulXUnitStatement()) { continue; } int currentLevel = currentLine.GetLevel(); if (currentLine.IsClass()) { AddNewUtInfo(fullFileName, rootUtInfo, currentLevel, currentLine); } else if (currentLine.IsFact() || currentLine.IsTheory() || currentLine.IsInlineData()) { isFact = true; isParameterized = currentLine.IsTheory() || currentLine.IsInlineData(); } else if (isFact && currentLine.IsMethod()) { UTInfo parentUTInfo = GetFieldParentClass(rootUtInfo, currentLevel); parentUTInfo.ThenList.Add(new ThenInfo { Description = currentLine.ToMethodName(), IsParameterized = isParameterized }); isFact = false; isParameterized = false; } } } rootUtInfo.ClearEmptyChildren(); return(rootUtInfo.Children); }
public List <UTInfo> Export(string fileFullName) { var rootUtInfo = new UTInfo(fileFullName); using (var streamReader = new StreamReader(fileFullName)) { while (!streamReader.EndOfStream) { string currentLine = streamReader.ReadLine(); if (currentLine.IsComment() || !currentLine.IsDescribeOrIt()) { continue; } int currentLevel = currentLine.GetLevel(); if (currentLine.IsDescribe()) { UTInfo parentUtInfo = GetDescribeParent(rootUtInfo, currentLevel); UTInfo currentUtInfo = new UTInfo(fileFullName) { Description = currentLine.ToDescribeDescription(), Parent = parentUtInfo }; parentUtInfo.Children.Add(currentUtInfo); } if (currentLine.IsIt()) { UTInfo parentUTInfo = GetItParent(rootUtInfo, currentLevel); parentUTInfo.ThenList.Add(new ThenInfo { Description = currentLine.ToItDescription() }); } } } rootUtInfo.ClearEmptyChildren(); return(rootUtInfo.Children); }
public List <UTInfo> Export(string fullFileName) { var rootUtInfo = new UTInfo(fullFileName); using (var streamReader = new StreamReader(fullFileName)) { while (!streamReader.EndOfStream) { string currentLine = streamReader.ReadLine(); if (currentLine.IsComment() || !currentLine.IsUsefulMSpecStatement()) { continue; } int currentLevel = currentLine.GetLevel(); if (currentLine.IsClass()) { AddClass(fullFileName, rootUtInfo, currentLevel, currentLine); } if (currentLine.IsBecause()) { AddBecause(rootUtInfo, currentLevel, currentLine); } if (currentLine.IsIt()) { AddIt(rootUtInfo, currentLevel, currentLine); } } } rootUtInfo.ClearEmptyChildren(); return(rootUtInfo.Children); }