public void TestProcedureParametersNone() { var proc = FileBuilder.ParseProcedure("void Func(){}"); Assert.AreEqual(typeof(void), proc.ReturnType.Type); Assert.AreEqual(0, proc.Parameters.Length); }
public void TestProcedureParametersSingleInput() { var proc = FileBuilder.ParseProcedure("void Func(int a){}"); Assert.AreEqual(typeof(void), proc.ReturnType.Type); Assert.AreEqual(1, proc.Parameters.Length); }
public void TestPropertyBlockTypedWithSingleValue() { var block = FileBuilder.ParsePropertyBlock("{ anden anders = \"Jens\" }"); AssertBlockWithOneValue(block, "anden", "anders", "Jens"); block = FileBuilder.ParsePropertyBlock("{ cykel fisken bent = 52 }"); AssertBlockWithOneValue(block, "cykel fisken", "bent", 52L); block = FileBuilder.ParsePropertyBlock("{ svensker goblen christian = 0xA7 }"); AssertBlockWithOneValue(block, "svensker goblen", "christian", 0xA7L); block = FileBuilder.ParsePropertyBlock("{ private int dennis = 3Bh }"); AssertBlockWithOneValue(block, "private int", "dennis", 0x3BL); block = FileBuilder.ParsePropertyBlock("{ premature verdict eric = error }"); AssertBlockWithOneValue(block, "premature verdict", "eric", Verdict.Error); block = FileBuilder.ParsePropertyBlock("{ int double flemming = 3.1417 }"); AssertBlockWithOneValue(block, "int double", "flemming", 3.1417); block = FileBuilder.ParsePropertyBlock("{ override partner gert = true }"); AssertBlockWithOneValue(block, "override partner", "gert", true); block = FileBuilder.ParsePropertyBlock("{ execution log hubert = 14.5ms }"); AssertBlockWithOneValue(block, "execution log", "hubert", TimeSpan.FromTicks((TimeSpan.TicksPerMillisecond * 145) / 10)); }
public async Task <DbResponse <SliderListModel> > AddAsync(SliderAddModel model, string userName, ICloudStorage cloudStorage, IFormFile file) { try { var registrationId = _db.Registration.GetRegID_ByUserName(userName); if (registrationId == 0) { return(new DbResponse <SliderListModel>(false, "Invalid User")); } model.CreatedByRegistrationId = registrationId; if (file == null) { return(new DbResponse <SliderListModel>(false, "Invalid Data")); } var fileName = FileBuilder.FileNameImage("slider", file.FileName); model.ImageFileName = await cloudStorage.UploadFileAsync(file, fileName); _db.Slider.Add(model); _db.SaveChanges(); var data = _mapper.Map <SliderListModel>(_db.Slider.Slider); return(new DbResponse <SliderListModel>(true, "Success", data)); } catch (Exception e) { return(new DbResponse <SliderListModel>(false, e.Message)); } }
internal IFileProcedure CreateTestFile(string procedureName) { var f = new StringBuilder(); f.AppendLine("namespace MyFile;"); f.AppendLine("procedure void Anders()"); f.AppendLine("{"); f.AppendLine(" step 1;"); f.AppendLine(" step 2;"); f.AppendLine(" step 3;"); f.AppendLine("}"); f.AppendLine("procedure void Bent()"); f.AppendLine("{"); f.AppendLine(" step \"First\";"); f.AppendLine(" step \"Second\";"); f.AppendLine(" step \"Third\";"); f.AppendLine("}"); f.AppendLine("procedure void Christian()"); f.AppendLine("{"); f.AppendLine(" step 1, \"First\";"); f.AppendLine(" step 2, \"Second\";"); f.AppendLine(" step 3, \"Third\";"); f.AppendLine("}"); var file = FileBuilder.ParseFile(null, f.ToString()); Assert.AreEqual(3, file.ListElements().Where(e => e.ElementType == FileElementType.ProcedureDeclaration).Count()); var procedure = file.ListElements().First(p => p.Name == procedureName) as IFileProcedure; Assert.AreEqual(procedureName, procedure.Name); return(procedure); }
public async Task <DbResponse <VendorSliderModel> > AddAsync(VendorSliderModel model, string vendorUserName, ICloudStorage cloudStorage, IFormFile file) { try { if (file == null) { return(new DbResponse <VendorSliderModel>(false, "No image file found")); } var vendorId = _db.Registration.VendorIdByUserName(vendorUserName); if (vendorId == 0) { return(new DbResponse <VendorSliderModel>(false, "Invalid User")); } var fileName = FileBuilder.FileNameImage("store", file.FileName); model.ImageFileName = await cloudStorage.UploadFileAsync(file, fileName); model.VendorId = vendorId; _db.VendorStoreSlider.Add(model); _db.SaveChanges(); var data = _mapper.Map <VendorSliderModel>(_db.VendorStoreSlider.VendorStoreSlider); return(new DbResponse <VendorSliderModel>(true, "Success", data)); } catch (Exception e) { return(new DbResponse <VendorSliderModel>(false, e.Message)); } }
private void Get_top_lineups_btn_Click(object sender, EventArgs e) { string fp = lineup_bp_text.Text; string topLineups = FileBuilder.GetTxtText(fp); top_lineups_tb.Text = topLineups; }
public void TestTableWithColumnsAndNoRows() { var table = FileBuilder.ParseDatatable( "datatable MyTable\r\n" + "|___| Ax | By |\r\n" + "| | 10 | True |\r\n" + "| | 63 | False |\r\n" + "| | 24 | False |\r\n"); Assert.AreEqual(2L, table.ColumnCount); Assert.AreEqual(3L, table.RowCount); Assert.AreEqual("Ax", table.GetColumn(0).Name); Assert.IsNull(table.GetColumn(0).Reference); Assert.IsNull(table.GetColumn(0).CellType); Assert.AreEqual("By", table.GetColumn(1).Name); Assert.IsNull(table.GetColumn(1).Reference); Assert.IsNull(table.GetColumn(1).CellType); Assert.AreEqual("10", table.GetCell(0, 0).CellText); Assert.AreEqual("63", table.GetCell(0, 1).CellText); Assert.AreEqual("24", table.GetCell(0, 2).CellText); Assert.AreEqual("True", table.GetCell(1, 0).CellText); Assert.AreEqual("False", table.GetCell(1, 1).CellText); Assert.AreEqual("False", table.GetCell(1, 2).CellText); }
public List <SimulatedConfiguration> Run(List <Configuration> configurations, List <string> selectedTraces) { Process p = new Process { StartInfo = { FileName = "psatsim_con.exe", Arguments = Arguments, WorkingDirectory = @"C:\Program Files (x86)\PSATSim", UseShellExecute = true, CreateNoWindow = true, WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden } }; FileBuilder.WriteXML(configurations, selectedTraces, Input); Console.WriteLine("Starting simulator..."); p.Start(); while (!p.HasExited) { } Thread.Sleep(100); Console.WriteLine("Exited with code:{0} ", p.ExitCode); p = null; return(FileBuilder.ReadXML(configurations, Output)); }
public void TesSBPecialFileVariableWithPropblockConfig() { var f = new StringBuilder(); f.AppendLine("using " + typeof(DummyInstrumentClass).Namespace + ";"); f.AppendLine("namespace ObjectUsing;"); f.AppendLine("public " + typeof(DummyInstrumentClass).Name + " myTool"); f.AppendLine("{"); f.AppendLine(" BoolA: true,"); f.AppendLine(" IntA: 19"); //f.AppendLine(" Names: [\"Anders\", \"Bent\", \"Chris\"]"); f.AppendLine("}"); f.AppendLine("procedure int UseObject()"); f.AppendLine("{"); f.AppendLine(" return myTool.Fcn(\"Janse\", false);"); f.AppendLine("}"); var files = FileBuilder.ParseFiles((ILogger)null, this.GetType().Assembly, new Tuple <string, string>("myfile.sbs", f.ToString())); Assert.AreEqual("ObjectUsing", files[0].Namespace); var procedure = files[0].ListElements().First(p => p.Name == "UseObject") as IFileProcedure; Assert.AreEqual("UseObject", procedure.Name); var taskContext = ExecutionHelper.ExeContext(); var result = taskContext.CallProcedure(procedure); Assert.AreEqual(19L, result); }
public static bool ParseFiles(bool force) { if (force || CheckIfFileParsingNeeded()) { ILoggerScope logger = null; try { logger = m_rootLogger.LogEntering("StepBro.Main", "Starting file parsing"); foreach (var f in m_loadedFilesManager.ListFiles <ScriptFile>()) { f.ResetBeforeParsing(preserveUpdateableElements: force == false); } m_lastParsingErrorCount = FileBuilder.ParseFiles(m_serviceManagerAdmin.Manager, logger); } finally { logger.LogExit("StepBro.Main", $"Ended file parsing. {m_lastParsingErrorCount} errors."); } return(m_lastParsingErrorCount == 0); } else { return(true); // Success (at least no failures) ... } }
/// <summary> /// Based on the provided <see cref="FileBuilder"/>, filter by namespaces and specified type names if necessary /// </summary> /// <param name="types"></param> /// <param name="inputSettings"></param> /// <returns></returns> public static Type[] FilterBy(this IEnumerable <Type> types, FileBuilder inputSettings) { var namespaceSettings = inputSettings.Namespaces; if (namespaceSettings != null) { types = types.Where(t => namespaceSettings.Any(n => n.Name == t.Namespace)); var nameSpacesWithoutTypes = namespaceSettings .Where(n => n.Types == null || !n.Types.Any()) .Select(n => n.Name); var specifiedTypes = namespaceSettings .Where(n => n.Types != null) .SelectMany(n => n.Types) .ToList(); //If user's specified types within a namespace, only return those types if (specifiedTypes.Any()) { types = types .Where(t => specifiedTypes .Any(type => nameSpacesWithoutTypes.Contains(t.Namespace) || type.Name == t.Name)); } } return(types.ToArray()); }
public void TestPropertyBlockWithSingleValue() { var block = FileBuilder.ParsePropertyBlock("{ anders = \"Jens\" }"); AssertBlockWithOneValue(block, "anders", "Jens"); block = FileBuilder.ParsePropertyBlock("{ bent = 52 }"); AssertBlockWithOneValue(block, "bent", 52L); block = FileBuilder.ParsePropertyBlock("{ christian = 0xA7 }"); AssertBlockWithOneValue(block, "christian", 0xA7L); block = FileBuilder.ParsePropertyBlock("{ dennis = 3Bh }"); AssertBlockWithOneValue(block, "dennis", 0x3BL); block = FileBuilder.ParsePropertyBlock("{ eric = error }"); AssertBlockWithOneValue(block, "eric", Verdict.Error); block = FileBuilder.ParsePropertyBlock("{ flemming = 3.1417 }"); AssertBlockWithOneValue(block, "flemming", 3.1417); block = FileBuilder.ParsePropertyBlock("{ gert = true }"); AssertBlockWithOneValue(block, "gert", true); block = FileBuilder.ParsePropertyBlock("{ hubert = 14.5ms }"); AssertBlockWithOneValue(block, "hubert", TimeSpan.FromTicks((TimeSpan.TicksPerMillisecond * 145) / 10)); block = FileBuilder.ParsePropertyBlock("{ \"Ivan Petersen\" = 40 }"); AssertBlockWithOneValue(block, "Ivan Petersen", 40L); }
public void TestProcedureParametersOnlyReturn() { var proc = FileBuilder.ParseProcedure("int Func(){}"); Assert.AreEqual(typeof(long), proc.ReturnType.Type); Assert.AreEqual(0, proc.Parameters.Length); }
public void FileParsing_AccessVariablesSameNamespace() { var files = FileBuilder.ParseFiles((ILogger)null, new Tuple <string, string>("andrea.sbs", "using \"betty.sbs\"; namespace Anders; procedure int Absalon(){ \r\n int i = varPublic;\r\n i += varProtected;\r\n return i; }"), new Tuple <string, string>("betty.sbs", "namespace Anders; public int varPublic = 5; protected int varProtected = 8; private int varPrivate = 11;")); Assert.AreEqual(2, files.Length); Assert.AreEqual("andrea.sbs", files[0].FileName); Assert.AreEqual("betty.sbs", files[1].FileName); Assert.AreEqual(0, files[0].Errors.ErrorCount); Assert.AreEqual(0, files[1].Errors.ErrorCount); var procedureA = files[0].ListElements().First(p => p.Name == "Absalon") as IFileProcedure; Assert.IsNotNull(procedureA); var element = files[1].ListElements().First(p => p.Name == "varPublic") as IFileElement; Assert.IsNotNull(element); element = files[1].ListElements().First(p => p.Name == "varProtected") as IFileElement; Assert.IsNotNull(element); element = files[1].ListElements().First(p => p.Name == "varPrivate") as IFileElement; Assert.IsNotNull(element); var taskContext = ExecutionHelper.ExeContext(services: FileBuilder.LastServiceManager.Manager); var result = taskContext.CallProcedure(procedureA); Assert.AreEqual(13L, result); }
public void TestLiteralVerdict() { var result = FileBuilder.ParseLiteral("pass"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is Verdict); Assert.AreEqual(Verdict.Pass, (Verdict)result.Value); result = FileBuilder.ParseLiteral("inconclusive"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is Verdict); Assert.AreEqual(Verdict.Inconclusive, (Verdict)result.Value); result = FileBuilder.ParseLiteral("fail"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is Verdict); Assert.AreEqual(Verdict.Fail, (Verdict)result.Value); result = FileBuilder.ParseLiteral("error"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is Verdict); Assert.AreEqual(Verdict.Error, (Verdict)result.Value); result = FileBuilder.ParseLiteral("unset"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is Verdict); Assert.AreEqual(Verdict.Unset, (Verdict)result.Value); }
public void ErrorHandling_ContinueOnFail() { // With title and expect is passing var f = new StringBuilder(); f.AppendLine("bool MyProcedure() : ContinueOnFail"); f.AppendLine("{"); f.AppendLine(" expect (4 < 10);"); f.AppendLine(" expect (7 < 10);"); f.AppendLine(" expect (10 < 10);"); f.AppendLine(" expect (9 < 10);"); f.AppendLine(" return true;"); f.AppendLine("}"); var file = FileBuilder.ParseFile(null, f.ToString()); var procedure = file.GetFileElement <IFileProcedure>("MyProcedure");; var taskContext = ExecutionHelper.ExeContext(); var result = taskContext.CallProcedure(procedure); Assert.AreEqual(true, (bool)result); var log = new LogInspector(taskContext.Logger); log.DebugDump(); log.ExpectNext("0 - Pre - TestRun - Starting"); log.ExpectNext("1 - Pre - MyProcedure - <arguments>"); log.ExpectNext("2 - Normal - 3 - EXPECT: 4<10; Actual: <TRUE> => Pass"); log.ExpectNext("2 - Normal - 4 - EXPECT: 7<10; Actual: <TRUE> => Pass"); log.ExpectNext("2 - Error - 5 - EXPECT: 10<10; Actual: <FALSE> => Fail"); log.ExpectNext("2 - Normal - 6 - EXPECT: 9<10; Actual: <TRUE> => Pass"); log.ExpectNext("2 - Post"); }
public void TestLiteralTimespan() { var result = FileBuilder.ParseLiteral("10s"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is TimeSpan); Assert.AreEqual(TimeSpan.FromSeconds(10), (TimeSpan)result.Value); result = FileBuilder.ParseLiteral("5.6ms"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is TimeSpan); Assert.AreEqual(TimeSpan.FromTicks((TimeSpan.TicksPerMillisecond * 56) / 10), (TimeSpan)result.Value); result = FileBuilder.ParseLiteral("@0:10"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is TimeSpan); Assert.AreEqual(TimeSpan.FromTicks(TimeSpan.TicksPerSecond * 10), (TimeSpan)result.Value); result = FileBuilder.ParseLiteral("@0:02:20"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is TimeSpan); Assert.AreEqual(TimeSpan.FromTicks(TimeSpan.TicksPerSecond * (2 * 60 + 20)), (TimeSpan)result.Value); result = FileBuilder.ParseLiteral("@0:10.72"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is TimeSpan); Assert.AreEqual(TimeSpan.FromTicks(TimeSpan.TicksPerMillisecond * 10720), (TimeSpan)result.Value); result = FileBuilder.ParseLiteral("@0:03:45.35"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is TimeSpan); Assert.AreEqual(TimeSpan.FromTicks(TimeSpan.TicksPerMillisecond * (225350)), (TimeSpan)result.Value); }
public void TestLiteralRange() { var result = FileBuilder.ParseLiteral("@[5]"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is Range); Assert.AreEqual("5", result.Value.ToString()); result = FileBuilder.ParseLiteral("@[..7]"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is Range); Assert.AreEqual("..7", result.Value.ToString()); result = FileBuilder.ParseLiteral("@[-4..]"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is Range); Assert.AreEqual("-4..", result.Value.ToString()); result = FileBuilder.ParseLiteral("@[-2..72]"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is Range); Assert.AreEqual("-2..72", result.Value.ToString()); result = FileBuilder.ParseLiteral("@[..-31,-15,-2,0,7,92,100..199,300..]"); Assert.IsTrue(result.IsConstant); Assert.IsTrue(result.Value is Range); Assert.AreEqual("..-31, -15, -2, 0, 7, 92, 100..199, 300..", result.Value.ToString()); }
public void ParseSingleArgument() { var result = FileBuilder.ParseSimpleArguments("()"); Assert.AreEqual(0, result.Item2.ErrorCount); Assert.AreEqual(0, result.Item1.Count); result = FileBuilder.ParseSimpleArguments("(635)"); Assert.AreEqual(0, result.Item2.ErrorCount); Assert.AreEqual(1, result.Item1.Count); Assert.AreEqual(SBExpressionType.Constant, result.Item1.Peek().ReferencedType); Assert.AreEqual(typeof(long), result.Item1.Peek().DataType.Type); Assert.AreEqual(635L, result.Item1.Peek().Value); result = FileBuilder.ParseSimpleArguments("(true)"); Assert.AreEqual(0, result.Item2.ErrorCount); Assert.AreEqual(1, result.Item1.Count); Assert.AreEqual(SBExpressionType.Constant, result.Item1.Peek().ReferencedType); Assert.AreEqual(typeof(bool), result.Item1.Peek().DataType.Type); Assert.AreEqual(true, result.Item1.Peek().Value); result = FileBuilder.ParseSimpleArguments("(125ms)"); Assert.AreEqual(0, result.Item2.ErrorCount); Assert.AreEqual(1, result.Item1.Count); Assert.AreEqual(SBExpressionType.Constant, result.Item1.Peek().ReferencedType); Assert.AreEqual(typeof(TimeSpan), result.Item1.Peek().DataType.Type); Assert.AreEqual(TimeSpan.FromTicks(TimeSpan.TicksPerMillisecond * 125), result.Item1.Peek().Value); result = FileBuilder.ParseSimpleArguments("('absolut')"); Assert.AreEqual(0, result.Item2.ErrorCount); Assert.AreEqual(1, result.Item1.Count); Assert.AreEqual(SBExpressionType.Constant, result.Item1.Peek().ReferencedType); Assert.AreEqual(typeof(Identifier), result.Item1.Peek().DataType.Type); Assert.AreEqual("absolut", ((Identifier)(result.Item1.Peek().Value)).Name); }
internal static SBExpressionData ParseUsingDummyClass(string expression, int expectedErrorCount = 0) { var builder = FileBuilder.ParseParExpression(typeof(DummyClass), null, expression); Assert.AreEqual(expectedErrorCount, builder.Errors.ErrorCount); return(builder.Listener.GetExpressionResult()); }
public void TestPropertyBlockDoubleTypedWithSingleValue() { var block = FileBuilder.ParsePropertyBlock("{ anden anders antonsen = \"Jens\" }"); AssertBlockWithOneValue(block, "anden anders", "antonsen", "Jens"); block = FileBuilder.ParsePropertyBlock("{ fisken bent = 52 }"); AssertBlockWithOneValue(block, "fisken", "bent", 52L); block = FileBuilder.ParsePropertyBlock("{ goblen christian = 0xA7 }"); AssertBlockWithOneValue(block, "goblen", "christian", 0xA7L); block = FileBuilder.ParsePropertyBlock("{ int dennis = 3Bh }"); AssertBlockWithOneValue(block, "int", "dennis", 0x3BL); block = FileBuilder.ParsePropertyBlock("{ verdict eric = error }"); AssertBlockWithOneValue(block, "verdict", "eric", Verdict.Error); block = FileBuilder.ParsePropertyBlock("{ double flemming = 3.1417 }"); AssertBlockWithOneValue(block, "double", "flemming", 3.1417); block = FileBuilder.ParsePropertyBlock("{ procedure gert = true }"); AssertBlockWithOneValue(block, "procedure", "gert", true); block = FileBuilder.ParsePropertyBlock("{ log hubert = 14.5ms }"); AssertBlockWithOneValue(block, "log", "hubert", TimeSpan.FromTicks((TimeSpan.TicksPerMillisecond * 145) / 10)); }
public void ErrorHandling_SubProcedure_Pass() { // With title and expect is passing var f = new StringBuilder(); f.AppendLine("bool MySub()"); f.AppendLine("{"); f.AppendLine(" log (\"ResultB1: \" + this.Result.Verdict);"); f.AppendLine(" log (\"ResultB1.HasFails: \" + this.HasFails);"); f.AppendLine(" log (\"ResultB1.HasErrors: \" + this.HasErrors);"); f.AppendLine(" expect (4 < 10);"); f.AppendLine(" log (\"ResultB2: \" + this.Result.Verdict);"); f.AppendLine(" log (\"ResultB2.HasFails: \" + this.HasFails);"); f.AppendLine(" log (\"ResultB2.HasErrors: \" + this.HasErrors);"); f.AppendLine(" return true;"); f.AppendLine("}"); f.AppendLine("bool MyProcedure()"); f.AppendLine("{"); f.AppendLine(" bool result;"); f.AppendLine(" log (\"ResultA1: \" + this.Result.Verdict);"); f.AppendLine(" log (\"ResultA1.HasFails: \" + this.HasFails);"); f.AppendLine(" log (\"ResultA1.HasErrors: \" + this.HasErrors);"); f.AppendLine(" result = MySub();"); f.AppendLine(" log (\"ResultA2: \" + this.Result.Verdict);"); f.AppendLine(" log (\"ResultA2.HasFails: \" + this.HasFails);"); f.AppendLine(" log (\"ResultA2.HasErrors: \" + this.HasErrors);"); f.AppendLine(" return result;"); f.AppendLine("}"); var file = FileBuilder.ParseFile(null, f.ToString()); var procedure = file.GetFileElement <IFileProcedure>("MyProcedure");; var taskContext = ExecutionHelper.ExeContext(); var result = taskContext.CallProcedure(procedure); Assert.AreEqual(true, (bool)result); var log = new LogInspector(taskContext.Logger); log.DebugDump(); log.ExpectNext("0 - Pre - TestRun - Starting"); log.ExpectNext("1 - Pre - MyProcedure - <arguments>"); log.ExpectNext("2 - Normal - 15 - log: ResultA1: Unset"); log.ExpectNext("2 - Normal - 16 - log: ResultA1.HasFails: False"); log.ExpectNext("2 - Normal - 17 - log: ResultA1.HasErrors: False"); log.ExpectNext("2 - Pre - MySub - <arguments>"); log.ExpectNext("3 - Normal - 3 - log: ResultB1: Unset"); log.ExpectNext("3 - Normal - 4 - log: ResultB1.HasFails: False"); log.ExpectNext("3 - Normal - 5 - log: ResultB1.HasErrors: False"); log.ExpectNext("3 - Normal - 6 - EXPECT: 4<10; Actual: <TRUE> => Pass"); log.ExpectNext("3 - Normal - 7 - log: ResultB2: Pass"); log.ExpectNext("3 - Normal - 8 - log: ResultB2.HasFails: False"); log.ExpectNext("3 - Normal - 9 - log: ResultB2.HasErrors: False"); log.ExpectNext("3 - Post"); log.ExpectNext("2 - Normal - 19 - log: ResultA2: Pass"); log.ExpectNext("2 - Normal - 20 - log: ResultA2.HasFails: False"); log.ExpectNext("2 - Normal - 21 - log: ResultA2.HasErrors: False"); log.ExpectNext("2 - Post"); }
private void Generate_CSV_btn_Click(object sender, EventArgs e) { string fp = FileBuilder.GetFilepath(DocumentFilepaths.PlayersWithProjections, UserBasepath, Date, Basketball); FileBuilder.BuildCSV(Players, fp); FileBuilder.BuildConfig(Lineups_tb.Text, MaxPrice_tb.Text, WTNR_tb.Text, basepath_tb.Text, Date); MessageBox.Show("Success! Your CSV is located at " + fp, "Success", MessageBoxButtons.OK, MessageBoxIcon.None); }
internal static IErrorCollector ParseError(string expression) { var builder = FileBuilder.ParseExpression( null, new Type[] { typeof(ExpressionParser) }, expression); return(builder.Errors); }
public FileDto Parse(string[] lines) { var fileBuilder = new FileBuilder(); var result = fileBuilder.Build(lines); return(result.Item1); }
public IActionResult Export() { // Export data as a csv file var entities = _contactsService.GetAll(); var streamFile = new FileBuilder(FileType.Csv).GetFile <Contact>(entities); return(File(streamFile.Contents, streamFile.ContentType, streamFile.Name)); }
public void TestPropertyBlockWithMoreValues() { var block = FileBuilder.ParsePropertyBlock("{ anders = \"Jens\", berit = true, chris=23.7s }"); Assert.AreEqual("{ anders=Jens, berit=True, chris=00:00:23.7000000 }", block.GetTestString()); block = FileBuilder.ParsePropertyBlock("{ anders = \"Jens\", pigen berit = true, drengen chris=23.7s }"); Assert.AreEqual("{ anders=Jens, pigen berit=True, drengen chris=00:00:23.7000000 }", block.GetTestString()); }
public void TestPropertyBlockSimpleNullValue() { var block = FileBuilder.ParsePropertyBlock("{ ftms = null }"); Assert.AreEqual("{ ftms=<null> }", block.GetTestString()); block = FileBuilder.ParsePropertyBlock("{ lgbt ftms = null }"); Assert.AreEqual("{ lgbt ftms=<null> }", block.GetTestString()); }
public void TestPropertyBlockNested() { var block = FileBuilder.ParsePropertyBlock("{ abe = { f1 = true, f2 = 12 }, bavian = { citron={x=15,y=2}, appelsin = \"Nora\" } }"); Assert.AreEqual("{ abe = { f1=True, f2=12 }, bavian = { citron = { x=15, y=2 }, appelsin=Nora } }", block.GetTestString()); block = FileBuilder.ParsePropertyBlock("{ axe abe = { f1 = true, fly f2 = 12 }, monkey bavian = { citron={x=15,y1 y2=2}, dejlig appelsin = \"Nora\" } }"); Assert.AreEqual("{ axe abe = { f1=True, fly f2=12 }, monkey bavian = { citron = { x=15, y1 y2=2 }, dejlig appelsin=Nora } }", block.GetTestString()); }