public void Print_ShouldPrintExpression() { var a = new Lit(7); var b = new Lit(8); var sub = new Sub(a, b); Assert.That(sub.Accept(new Print()), Is.EqualTo("7-8")); }
public void Eval_ShouldAddTwoInteger() { var a = new Lit(7); var b = new Lit(8); var sub = new Sub(a, b); Assert.That(sub.Accept(new IntegerEval()), Is.EqualTo(-1)); }
public void Eval_ShouldAddTwoInteger() { var a = new Lit(7); var b = new Lit(8); var add = new Add(a, b); Assert.That(add.Accept(new IntegerEval()), Is.EqualTo(15)); }
public void Print_ShouldPrintAddExpression() { var a = new Lit(7); var b = new Lit(8); var add = new Add(a, b); Assert.That(add.Accept(new Print()), Is.EqualTo("7+8")); }
public ActionResult Edit([Bind(Include = "idLit,codeLit,idChambre")] Lit lit) { if (ModelState.IsValid) { db.Entry(lit).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.idChambre = new SelectList(db.chambres, "idCh", "codeCh", lit.idChambre); return(View(lit)); }
public void ResponseFile() { Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.ResponseFile = Path.Combine(InputTests.TestDataDirectory, @"ResponseFile\ResponseFile.txt"); lit.Run(); // verify the loc file added by the @ResponseFile is read and added to the library Verifier.VerifyWixLibLocString(lit.OutputFile, "en-us", "String1", "String1(en-us)"); }
public void TreatAllWarningsAsErrorSwitch() { Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.OtherArguments = " -abc"; lit.TreatAllWarningsAsErrors = true; lit.ExpectedWixMessages.Add(new WixMessage(1098, "'abc' is not a valid command line argument.", WixMessage.MessageTypeEnum.Error)); lit.ExpectedExitCode = 1098; lit.Run(); }
public void NoWixObjExtension() { Candle candle = new Candle(); candle.SourceFiles.Add(WixTests.PropertyFragmentWxs); candle.OutputFile = "Library"; candle.Run(); Lit lit = new Lit(candle); lit.Run(); }
public void MultipleWxlFiles() { Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.LocFiles.Add(Path.Combine(LocalizationTests.TestDataDirectory, @"Shared\en-US.wxl")); lit.LocFiles.Add(Path.Combine(LocalizationTests.TestDataDirectory, @"Shared\ja-JP.wxl")); lit.Run(); Verifier.VerifyWixLibLocString(lit.OutputFile, "en-us", "String1", "String1(en-us)"); Verifier.VerifyWixLibLocString(lit.OutputFile, "ja-jp", "String1", "String1(ja-jp)"); }
public ActionResult Create([Bind(Include = "idLit,codeLit,idChambre")] Lit lit) { if (ModelState.IsValid) { db.Lits.Add(lit); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.idChambre = new SelectList(db.Chambres, "idCh", "codeCh", lit.idChambre); return(View(lit)); }
public async Task <IActionResult> PostLit([FromBody] Lit lit) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.lits.Add(lit); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLit", new { id = lit.Numero_Lit }, lit)); }
public void TestSetChildren_TwoChildren() { var l = new Lit(1); var r = new Lit(2); var add = new Add(l, r); var newL = new Lit(3); var newR = new Lit(4); var newAdd = _rewriter.SetChildren(new[] { newL, newR }, add); Assert.Equal(new[] { newL, newR }, _rewriter.GetChildren(newAdd)); }
public void ValidFileWithUnknownExtension() { Candle candle = new Candle(); candle.SourceFiles.Add(WixTests.PropertyFragmentWxs); candle.OutputFile = "Library.foo"; candle.Run(); Lit lit = new Lit(candle); lit.Run(); }
public void ReadOnlyInputFile() { string testFile = Candle.Compile(WixTests.PropertyFragmentWxs); // Set the file to readonly File.SetAttributes(testFile, FileAttributes.ReadOnly); Lit lit = new Lit(); lit.ObjectFiles.Add(testFile); lit.Run(); }
public void DoubleQuotesInOutputFileName() { Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.OutputFile = "testfile\\\"wixobj"; lit.SetOutputFileIfNotSpecified = false; string expectedOutput = string.Format("Your file or directory path '{0}' cannot contain a quote. Quotes are often accidentally introduced when trying to refer to a directory path with spaces in it, such as \"C:\\Out Directory\\\". The correct representation for that path is: \"C:\\Out Directory\\\\\".", "testfile\"wixobj"); lit.ExpectedWixMessages.Add(new WixMessage(117, expectedOutput, WixMessage.MessageTypeEnum.Error)); lit.ExpectedExitCode = 117; lit.Run(); }
public void NonExistingInputFile() { string testFile = Path.Combine(Utilities.FileUtilities.GetUniqueFileName(), "foo.wixobj"); Lit lit = new Lit(); lit.ObjectFiles.Add(testFile); string outputString = String.Format("The system cannot find the file '{0}' with type 'Source'.", testFile); lit.ExpectedWixMessages.Add(new WixMessage(103, outputString, WixMessage.MessageTypeEnum.Error)); lit.ExpectedExitCode = 103; lit.Run(); }
public static void DeleteLit(Lit lit) { if (ConnexionBD.Instance().EstConnecte()) { ConnexionBD.Instance().ExecuterRequete( string.Format( "DELETE FROM Lits " + "WHERE idLit = {0}", lit._identifiant ) ); } }
public void MultipleWixlibsWithSameDirectories() { // Create Temp Directory string outputDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); Utilities.FileUtilities.CreateOutputDirectory(outputDirectory); string testDir = Path.Combine(WixlibTests.TestDataDirectory, "MultipleWixlibsWithDirs"); // Build the package Candle candle1 = new Candle(); candle1.SourceFiles.Add(Path.Combine(testDir, "Package.wxs")); candle1.OutputFile = Path.Combine(outputDirectory, "Package.wixobj"); candle1.Run(); // Build the first wixlib Candle candle2 = new Candle(); candle2.SourceFiles.Add(Path.Combine(testDir, "ProjectOne.wxs")); candle2.OutputFile = Path.Combine(outputDirectory, "ProjectOne.wixobj"); candle2.Run(); Lit lit2 = new Lit(candle2); lit2.OutputFile = Path.Combine(outputDirectory, "ProjectOne.wixlib"); lit2.Run(); // Build the second wixlib Candle candle3 = new Candle(); candle3.SourceFiles.Add(Path.Combine(testDir, "ProjectTwo.wxs")); candle3.OutputFile = Path.Combine(outputDirectory, "ProjectTwo.wixobj"); candle3.Run(); Lit lit3 = new Lit(candle3); lit3.OutputFile = Path.Combine(outputDirectory, "ProjectTwo.wixlib"); lit3.Run(); // Link everything together - will have duplicate directories Light light = new Light(); light.ObjectFiles.Add(candle1.OutputFile); light.ObjectFiles.Add(lit2.OutputFile); light.ObjectFiles.Add(lit3.OutputFile); light.OutputFile = Path.Combine(outputDirectory, "actual.msi"); light.Run("-ad"); // Verifier.VerifyResults(Path.Combine(testDir, "expected.msi"), light.OutputFile); }
public static void PutLit(Lit lit) { if (ConnexionBD.Instance().EstConnecte()) { ConnexionBD.Instance().ExecuterRequete( string.Format( "UPDATE Lits " + "SET idEtatLit = (SELECT idEtatLit FROM EtatsLits WHERE nom = '{0}') " + // Le numéro ne devrait pas pouvoir être modifié. "WHERE idLit = {1}", lit.EtatLit.ToString("g"), lit._identifiant ) ); } }
public void NonExistingOutputDirectory() { string outputDirectory = Utilities.FileUtilities.GetUniqueFileName(); Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.OutputFile = Path.Combine(outputDirectory, "SimpleFragment.wix"); lit.Run(); if (!File.Exists(Path.Combine(outputDirectory, "SimpleFragment.wix"))) { Assert.Fail("failed to create output directory specified in -out swith of lit"); } }
public void OutSwitch() { DirectoryInfo outputDirectory = Directory.CreateDirectory(Utilities.FileUtilities.GetUniqueFileName()); Lit lit = new Lit(); lit.ObjectFiles.Add(Candle.Compile(WixTests.PropertyFragmentWxs)); lit.OutputFile = Path.Combine(outputDirectory.FullName, "SimpleFragment.wix");; lit.Run(); if (!File.Exists(Path.Combine(outputDirectory.FullName, "SimpleFragment.wix"))) { Assert.Fail("failed to handle -out swith of lit"); } }
public void TestSetChildren_ManyChildren() { var zero = new Lit(0); var one = new Lit(1); var two = new Lit(2); var list = new List(ImmutableList <Expr> .Empty.Add(zero).Add(one).Add(two)); var new0 = new Lit(3); var new1 = new Lit(4); var new2 = new Lit(5); var newList = _rewriter.SetChildren(new[] { new0, new1, new2 }, list); Assert.Equal(new[] { new0, new1, new2 }, _rewriter.GetChildren(newList)); }
public void TestSetChildren_ThreeChildren() { var c = new Lit(0); var l = new Lit(1); var r = new Lit(2); var tern = new Ternary(c, l, r); var newC = new Lit(3); var newL = new Lit(4); var newR = new Lit(5); var newTern = _rewriter.SetChildren(new[] { newC, newL, newR }, tern); Assert.Equal(new[] { newC, newL, newR }, _rewriter.GetChildren(newTern)); }
public void TestSetChildren_EnumerableChildren() { var a = new Lit(0); var b = new Lit(1); var c = new Lit(2); var list = new List(ImmutableList <Expr> .Empty.Add(a).Add(b).Add(c)); var newA = new Lit(3); var newB = new Lit(4); var newC = new Lit(5); var newList = _rewriter.SetChildren(new[] { newA, newB, newC }, list); Assert.Equal(new[] { newA, newB, newC }, _rewriter.GetChildren(newList)); }
public static void PutLitCitoyen(Lit lit, Citoyen citoyen) { if (ConnexionBD.Instance().EstConnecte()) { ConnexionBD.Instance().ExecuterRequete( string.Format( "UPDATE Lits " + "SET idCitoyen = (SELECT idCitoyen FROM citoyens WHERE numAssuranceMaladie = '{0}') " + "WHERE idLit = {1}", citoyen.AssMaladie, lit._identifiant ) ); } }
// GET: Lits/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Lit lit = db.Lits.Find(id); if (lit == null) { return(HttpNotFound()); } return(View(lit)); }
public void NonAlphaNumericCharactersInFileName() { DirectoryInfo temporaryDirectory = Directory.CreateDirectory(Utilities.FileUtilities.GetUniqueFileName()); Candle candle = new Candle(); candle.SourceFiles.Add(WixTests.PropertyFragmentWxs); candle.OutputFile = Path.Combine(temporaryDirectory.FullName, "~!@#$%^&()_-=+,.wixobj"); candle.Run(); Lit lit = new Lit(candle); lit.Run(); }
public void TestSetChildren_ThreeChildren() { var c = new Lit(0); var t = new Lit(1); var f = new Lit(2); var ternary = new Ternary(c, t, f); var newC = new Lit(3); var newT = new Lit(4); var newF = new Lit(5); var newTernary = _rewriter.SetChildren(new[] { newC, newT, newF }, ternary); Assert.Equal(new[] { newC, newT, newF }, _rewriter.GetChildren(newTernary)); }
public void FileNameWithSingleQuotes() { DirectoryInfo temporaryDirectory = Directory.CreateDirectory(Utilities.FileUtilities.GetUniqueFileName()); Candle candle = new Candle(); candle.SourceFiles.Add(WixTests.PropertyFragmentWxs); candle.OutputFile = Path.Combine(temporaryDirectory.FullName, "'BasicProduct'.wixobj"); candle.Run(); Lit lit = new Lit(candle); lit.Run(); }
// GET: Lits/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Lit lit = db.Lits.Find(id); if (lit == null) { return(HttpNotFound()); } ViewBag.idChambre = new SelectList(db.Chambres, "idCh", "codeCh", lit.idChambre); return(View(lit)); }
public InputObj Clone() { return(new InputObj { Var = Var, Path = Path, Lit = Lit?.DeepClone(), Type = Type, Default = Default?.DeepClone(), Description = Description, Required = Required, UserDefined = UserDefined, Hidden = Hidden }); }
public void TestDescendantsAndSelfInContext() { var one = new Lit(1); var two = new Lit(2); var minusTwo = new Neg(two); Expr expr = new Add(one, minusTwo); var contexts = expr.DescendantsAndSelfInContext(); Assert.Equal(new Expr[] { one, two, minusTwo, expr }, contexts.Select(x => x.item)); var three = new Lit(3); var newExpr = contexts.ElementAt(0).replace(three); Assert.Equal(new Expr[] { three, minusTwo }, newExpr.GetChildren()); }
public void DownEditUp() { var replacement = new Lit(10); var cursor = _expr.Cursor(); cursor.Down(); cursor.Focus = replacement; cursor.Up(); Assert.NotSame(_expr, cursor.Focus); var add = Assert.IsType <Add>(cursor.Focus); Assert.Same(add.Right, ((Add)_expr).Right); Assert.Same(replacement, add.Left); }
public void TestChildrenInContext() { var one = new Lit(1); var two = new Lit(2); var minusTwo = new Neg(two); Expr expr = new Add(one, minusTwo); var childrenInContext = expr.ChildrenInContext(); Assert.Equal(new Expr[] { one, minusTwo }, childrenInContext.Select(x => x.item)); var three = new Lit(3); var newExpr = childrenInContext[0].replace(three); Assert.Equal(new Expr[] { three, minusTwo }, newExpr.GetChildren()); }