public TestProject() { this.RootDirectory = "/root"; this.MainOutputDirectory = "/out"; this.CompileFolder = "/compile"; var context = new BSharpContext(); context.Working.Add(new BSharpClass { Name = "x", Prototype = "a", Compiled = new XElement("class", new XAttribute("attr", "x")) }); context.Working.Add(new BSharpClass { Name = "y", Prototype = "a", Compiled = new XElement("class", new XAttribute("attr", "y")) }); context.Working.Add(new BSharpClass { Name = "z", Prototype = "b", Compiled = new XElement("class", new XAttribute("attr", "y")) }); context.BuildIndexes(); this.Context = context; }
private static IBSharpContext ParseContext(XElement xml) { var result = new BSharpContext(); result.Working = new List <IBSharpClass>(); foreach (var cls in xml.Elements("cls")) { var bcls = new BSharpClass(result); bcls.Set(BSharpClassAttributes.Built); bcls.Name = cls.Attr("name"); bcls.Namespace = cls.Attr("ns"); bcls.Compiled = cls.Elements().First(); result.Working.Add(bcls); } foreach (var error in xml.Elements("error")) { var e = new BSharpError { Type = error.Attr("type").To <BSharpErrorType>(), Message = error.Value }; var lexe = error.Element("lexinfo"); if (null != lexe) { e.LexInfo = new LexInfo(lexe.Attr("file"), lexe.Attr("line").ToInt()); } result.RegisterError(e); } result.BuildIndexes(); return(result); }
public UsersController(BSharpContext context, IMapper mapper, ILogger <UsersController> logger, IEmailSender emailSender, UserManager <User> userManager) { _context = context; _mapper = mapper; _logger = logger; _emailSender = emailSender; _userManager = userManager; }
public void MergableAsyncCall() { var ctx = new BSharpContext(); var p1 = BSharpCompiler.CompileAsync("class A").ContinueWith(_ => ctx.Merge(_.Result)); var p2 = BSharpCompiler.CompileAsync("class B").ContinueWith(_ => ctx.Merge(_.Result)); var p3 = BSharpCompiler.CompileAsync("class C").ContinueWith(_ => ctx.Merge(_.Result)); Task.WaitAll(p1, p2, p3); Assert.AreEqual(3, ctx.Working.Count); }
private static IBSharpContext ParseContext(XElement xml) { var result = new BSharpContext(); result.Working = new List<IBSharpClass>(); foreach (var cls in xml.Elements("cls")) { var bcls = new BSharpClass(result); bcls.Set(BSharpClassAttributes.Built); bcls.Name = cls.Attr("name"); bcls.Namespace = cls.Attr("ns"); bcls.Compiled = cls.Elements().First(); result.Working.Add(bcls); } foreach (var error in xml.Elements("error")) { var e = new BSharpError {Type = error.Attr("type").To<BSharpErrorType>(), Message = error.Value}; var lexe = error.Element("lexinfo"); if (null != lexe) { e.LexInfo = new LexInfo(lexe.Attr("file"), lexe.Attr("line").ToInt()); } result.RegisterError(e); } result.BuildIndexes(); return result; }
public void MergableAsyncCall(){ var ctx = new BSharpContext(); var p1 = BSharpCompiler.CompileAsync("class A").ContinueWith(_=>ctx.Merge(_.Result)); var p2 = BSharpCompiler.CompileAsync("class B").ContinueWith(_ => ctx.Merge(_.Result)); var p3 = BSharpCompiler.CompileAsync("class C").ContinueWith(_ => ctx.Merge(_.Result)); Task.WaitAll(p1, p2, p3); Assert.AreEqual(3,ctx.Working.Count); }
public StoresController(BSharpContext context, IMapper mapper, ILogger <UsersController> logger) { _context = context; _mapper = mapper; _logger = logger; }