mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
port batch parser wrapper (#232)
* Initial commit for GitHub IO pages * Add initial doxfx content * Update manifest.json * Update manifest.json * Set theme jekyll-theme-cayman * Set theme jekyll-theme-slate * Set theme jekyll-theme-minimal * Set theme jekyll-theme-tactile * Clear out theme setting * Remove API docs * Revert "Adding Milliseconds to DateTime fields (#173)" (#197) This reverts commit431dfa4156. * ported new BatchParser * added BatchParser tests * fixing merge conflicts * fix build issues * cleaned code and addressed comments from code review * addressed code review and made BatchParser logic more efficient * fixed batch parser tests * changed class name to fix build issues * fixed merge conflicts * added path for lab mode baseline tests * changed env path for lab mode * added env variable to appveyor * testing env variable for appveyor * fixed lab build * debug appveyor build * testing changes for appveyor * changed trace env path * debugging appveyor build * changed baseline env path * debugging * debugging * debugging * switched on trace flag * debugging * debugging * changed build config * changed baseline files * checking baseline output * changed baseline files * debug baseline tests * debugging baseline * debugging * debugging * debug * debugging * testing baseline format * debug * debug * debug * debug * debug * newline debug * changed baseline file * debug * test * try new way to read * added execution engine tests * change test * testing file encoding * moved execution engine tests to integration * try compare without spaces * removed no op test * added env variable for travis * put batch parser tests to integration too * put batch parser in integration * try new baseline string match * compare baseline test logic changed * changed baseline logic as well as cleaned tests * fix build for travis CI * fix travis CI issues * fixed highlighting bugs on vscode * code review changes * ported new BatchParser * added BatchParser tests * Initial commit for GitHub IO pages * Add initial doxfx content * Update manifest.json * Update manifest.json * Set theme jekyll-theme-cayman * Set theme jekyll-theme-slate * Set theme jekyll-theme-minimal * Set theme jekyll-theme-tactile * Clear out theme setting * Remove API docs * Revert "Adding Milliseconds to DateTime fields (#173)" (#197) This reverts commit431dfa4156. * fixing merge conflicts * fix build issues * cleaned code and addressed comments from code review * addressed code review and made BatchParser logic more efficient * fixed batch parser tests * changed class name to fix build issues * fixed merge conflicts * added path for lab mode baseline tests changed env path for lab mode added env variable to appveyor testing env variable for appveyor fixed lab build debug appveyor build testing changes for appveyor changed trace env path debugging appveyor build changed baseline env path debugging debugging debugging switched on trace flag debugging debugging changed build config changed baseline files checking baseline output changed baseline files debug baseline tests debugging baseline debugging debugging debug debugging testing baseline format debug debug debug debug debug newline debug changed baseline file debug test try new way to read added execution engine tests change test testing file encoding moved execution engine tests to integration try compare without spaces removed no op test added env variable for travis * put batch parser tests to integration too * put batch parser in integration try new baseline string match * compare baseline test logic changed * changed baseline logic as well as cleaned tests * fix build for travis CI * fix travis CI issues * fixed highlighting bugs on vscode * code review changes * fixed filestream writer test * added localization string * added localization string * generated new string files again * code review changes
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Test.Common.Baselined
|
||||
{
|
||||
public abstract class BaselinedTestWithMultipleScripts : BaselinedTest
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds the number of files that are associated with this test
|
||||
/// </summary>
|
||||
private int _fileCount;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets the amount of scripts to process
|
||||
/// </summary>
|
||||
public int FileCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return _fileCount;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < 1)
|
||||
throw new ArgumentOutOfRangeException("FileCount", value, "FileCount must be > 0");
|
||||
_fileCount = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public BaselinedTestWithMultipleScripts()
|
||||
: base()
|
||||
{
|
||||
//set invalid value
|
||||
_fileCount = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs the test
|
||||
/// </summary>
|
||||
public override void Run()
|
||||
{
|
||||
//little self-assigning sanity check there (if invalid value, it will throw)
|
||||
FileCount = FileCount;
|
||||
|
||||
//process all files
|
||||
for (int n = 0; n < FileCount; n++)
|
||||
{
|
||||
ProcessFile(GetTestscriptFilePath(this.CurrentTestName, n));
|
||||
}
|
||||
|
||||
PostProcessFiles();
|
||||
|
||||
Verify();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts a test with the specified fileCount
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the test</param>
|
||||
/// <param name="fileCount">Number of files</param>
|
||||
public void Start(string name, int fileCount)
|
||||
{
|
||||
FileCount = fileCount;
|
||||
base.Start(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method gives you an opportunity to handle one specific file
|
||||
/// </summary>
|
||||
/// <param name="filePath">Path to the current file</param>
|
||||
public abstract void ProcessFile(string filePath);
|
||||
|
||||
/// <summary>
|
||||
/// This method gives you an opportunity to perform any actions after files are processed
|
||||
/// </summary>
|
||||
public virtual void PostProcessFiles()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method will be called when all files have been processed; add verification logic here
|
||||
/// </summary>
|
||||
public abstract void Verify();
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user