public void SDKToolProcessRunnerTest_InitializeFromToolDirectory_GenerateAppxBundle_Success() { MakeAppxRunner runner; Log.Comment("Testing SDKToolProcessRunner, SDKDetector, MakeAppxRunner" + " by passing the Tool Directory."); VerifyOperation verifyOperation = delegate { runner = new MakeAppxRunner(this.testToolDirectory); }; Verify.NoThrow(verifyOperation); runner = new MakeAppxRunner(this.testToolDirectory) { OverwriteExistingFiles = true }; Log.Comment("MakeAppxRunner and SDKToolProcessRunner initialized successfully."); // Call GenerateAppxBundleFromRootFolder to test it. runner.GenerateAppxBundleFromRootFolder( "1.0.0.0", this.testDataDirectory + "AppxBundleTest", this.testDirectory + appxBundle); runner.Dispose(); Verify.AreEqual(true, File.Exists(this.testDirectory + "TestAppxBundle.AppxBundle")); Log.Comment("Tested MakeAppx Runner."); }
public void FileLoggerCriticalLogLevelTest() { Log.Comment("Testing the File Logger critical log level."); LogUtils.SetupFileLogger(this.filePath); LogProvider fileLogProvider = Logger.GetLogProvider(typeof(FileLog)); fileLogProvider.LogLevels = Logger.LogLevels.All; Log.Comment("Initialize the File Logger."); VerifyOperation initLog = new VerifyOperation(fileLogProvider.InitLog); Verify.NoThrow(initLog); Log.Comment("Logging text to the File Logger."); string logOutput = "This is a critical message logged to the File Logger"; Logger.Critical(logOutput); // Check if the log file is created. Log.Comment("Verifying the log file creation."); Verify.IsTrue(File.Exists(this.filePath)); fileLogProvider.DeinitLog(); // Check the contents of the file. Log.Comment("Verifying the log file contents."); Verify.IsTrue(File.ReadAllText(this.filePath).Contains(logOutput)); }
public void SDKToolProcessRunnerTest_IntializeFromCurrentPath_Success() { Log.Comment("Testing SDKToolProcessRunner, SDKDetector, MakeAppxRunner"); Log.Comment("MakeAppxRunner looks for the tool next to current assembly." + "If not found, looks for it in SDK Installation folder."); VerifyOperation verifyOperation = delegate { new MakeAppxRunner(); }; Verify.NoThrow(verifyOperation); Log.Comment("MakeAppxRunner and SDKToolProcessRunner initialized successfully."); }
/// <summary> /// VerifyTilesAsync /// assigns a delegate to the function Verify tiles to be run Asyncronously /// </summary> public void VerifyTilesAsync() { VerifyOperation addDel = VerifyTiles; // point delegate at a function to be called asynchronously AsyncCallback callbackDel; callbackDel = this.VerifyTiles_OnComplete; // point callback delegate at call back function // pass remote client callback reference addDel.BeginInvoke(callbackDel, OperationContext.Current.GetCallbackChannel <ITMBizControllerCallback>()); Console.WriteLine("Waiting for Verification..."); }
public void SDKToolProcessRunnerTest_InitializeFromToolPath_Failure() { // Delete the file from current path if it exists. if (File.Exists(this.testDirectory + toolName)) { File.Delete(this.testDirectory + toolName); Log.Comment("File Deleted in the test directory"); } // If the tool doesn't exist in the tool path and SDK is NOT installled, // Argument exception should be thrown. VerifyOperation verifyOperation = delegate { new MakeAppxRunner(); }; Verify.Throws <ArgumentException>(verifyOperation); Log.Comment("MakeAppxRunner and SDKToolProcessRunner throw exception as expected."); }
public void ConsoleLoggerCriticalLogLevelTest() { Log.Comment("Testing the Console Logger critical log level."); // VerfiyOperation makes sure no exceptions are thrown my SetUpConsoleLogger, which // indicates the success of the method call. VerifyOperation setUpConsoleLogger = new VerifyOperation(LogUtils.SetupConsoleLogger); Verify.NoThrow(setUpConsoleLogger); LogProvider consoleLogProvider = Logger.GetLogProvider(typeof(ConsoleLog)); Verify.IsNotNull(consoleLogProvider); consoleLogProvider.LogLevels = Logger.LogLevels.All; Log.Comment("Initialize Console Logger."); VerifyOperation initLog = new VerifyOperation(consoleLogProvider.InitLog); Verify.NoThrow(initLog); Log.Comment("Logging text to the Console Logger."); VerifyOperation logOperation = delegate { Logger.Critical("This is a trial critical message logged to the Console Logger"); }; Verify.NoThrow(logOperation); Log.Comment("Logging malformed string to the Console Logger."); VerifyOperation logStringOperation = delegate { Logger.Critical("This is a malformed {0} string logged to the Console Logger", null); }; Verify.Throws <Exception>(logStringOperation); Log.Comment("Deinitializing the Console Logger."); consoleLogProvider.DeinitLog(); }
/// <summary> /// Verify the integrity of the database specified by /// <paramref name="file"/> and <paramref name="database"/>. /// </summary> /// <remarks> /// <para> /// Berkeley DB normally verifies that btree keys and duplicate items /// are correctly sorted, and hash keys are correctly hashed. If the /// file being verified contains multiple databases using differing /// sorting or hashing algorithms, some of them must necessarily fail /// database verification because only one sort order or hash function /// can be specified in <paramref name="cfg"/>. To verify files with /// multiple databases having differing sorting orders or hashing /// functions, first perform verification of the file as a whole by /// using <see cref="VerifyOperation.NO_ORDER_CHECK"/>, and then /// individually verify the sort order and hashing function for each /// database in the file using /// <see cref="VerifyOperation.ORDER_CHECK_ONLY"/>. /// </para> /// </remarks> /// <param name="file"> /// The physical file in which the databases to be verified are found. /// </param> /// <param name="database"> /// The database in <paramref name="file"/> on which the database checks /// for btree and duplicate sort order and for hashing are to be /// performed. A non-null value for database is only allowed with /// <see cref="VerifyOperation.ORDER_CHECK_ONLY"/>. /// </param> /// <param name="cfg"> /// Configuration parameters for the databases to be verified. /// </param> /// <param name="op">The extent of verification</param> public static void Verify(string file, string database, DatabaseConfig cfg, VerifyOperation op) { using (Database db = new Database(cfg.Env, 0)) { db.Config(cfg); uint flags; switch (op) { case VerifyOperation.NO_ORDER_CHECK: flags = DbConstants.DB_NOORDERCHK; break; case VerifyOperation.ORDER_CHECK_ONLY: flags = DbConstants.DB_ORDERCHKONLY; break; case VerifyOperation.DEFAULT: default: flags = 0; break; } db.db.verify(file, database, null, null, flags); } }
/// <summary> /// Verify the integrity of all databases in the file specified by /// <paramref name="file"/>. /// </summary> /// <remarks> /// <para> /// Berkeley DB normally verifies that btree keys and duplicate items /// are correctly sorted, and hash keys are correctly hashed. If the /// file being verified contains multiple databases using differing /// sorting or hashing algorithms, some of them must necessarily fail /// database verification because only one sort order or hash function /// can be specified in <paramref name="cfg"/>. To verify files with /// multiple databases having differing sorting orders or hashing /// functions, first perform verification of the file as a whole by /// using <see cref="VerifyOperation.NO_ORDER_CHECK"/>, and then /// individually verify the sort order and hashing function for each /// database in the file using /// <see cref="VerifyOperation.ORDER_CHECK_ONLY"/>. /// </para> /// </remarks> /// <param name="file"> /// The physical file in which the databases to be verified are found. /// </param> /// <param name="cfg"> /// Configuration parameters for the databases to be verified. /// </param> /// <param name="op">The extent of verification</param> public static void Verify( string file, DatabaseConfig cfg, VerifyOperation op) { Verify(file, null, cfg, op); }