本文整理汇总了C#中Runner类的典型用法代码示例。如果您正苦于以下问题:C# Runner类的具体用法?C# Runner怎么用?C# Runner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Runner类属于命名空间,在下文中一共展示了Runner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
public void Start()
{
_updateNextFrame = true;
_buildMode = FindObjectOfType<BuildMode>();
_imageSetter = GetComponent<ImageSetter>();
_runner = FindObjectOfType<Runner>();
}
示例2: InitializeTestEngineResult
public void InitializeTestEngineResult()
{
// Save the local directory - used by GetLocalPath
Uri uri = new Uri(Assembly.GetExecutingAssembly().CodeBase);
localDirectory = Path.GetDirectoryName(uri.LocalPath);
AssemblyPath = GetLocalPath(AssemblyName);
// Create a fresh copy of the engine, since we can't use the
// one that is running this test.
engine = TestEngineActivator.CreateInstance();
engine.InternalTraceLevel = InternalTraceLevel.Off;
// Create a new DefaultAssemblyRunner, which is actually a framework class,
// because we can't use the one that's currently running this test.
var runner = new Runner(new Builder());
var settings = new Dictionary<string, object>();
// Make sure the runner loaded the mock assembly.
Assert.That(
runner.Load(AssemblyPath, settings).RunState.ToString(),
Is.EqualTo("Runnable"),
"Unable to load mock-nunit-assembly.exe");
// Run the tests, saving the result as an XML string
var xmlText = runner.Run(TestListener.NULL, TestFilter.Empty).ToXml(true).OuterXml;
// Create a TestEngineResult from the string, just as the TestEngine does,
// then add a test-run element to the result, wrapping the result so it
// looks just like what the engine would return!
this.EngineResult = new TestEngineResult(xmlText).Aggregate("test-run", AssemblyName, AssemblyPath);
}
示例3: Execute
public void Execute()
{
var packagePath = Path.Combine(Environment.CurrentDirectory, "NugetPackageFiles");
packagePath = Path.GetFullPath(packagePath);
var runner = new Runner
{
PackageDirectory = packagePath,
MetadataAssembly="Standard.dll",
WriteInfo = s => Debug.WriteLine(s)
};
runner.Execute();
var outputFile = Path.Combine(packagePath, "MyPackage.1.0.nupkg");
var expectedFIle = Path.Combine(Environment.CurrentDirectory, "MyPackage.1.0.nupkg ");
using (var package1 = Package.Open(expectedFIle))
using (var package2 = Package.Open(outputFile))
{
foreach (var part1 in package1.GetParts())
{
if (part1.Uri.OriginalString.EndsWith("psmdcp"))
{
continue;
}
if (part1.Uri.OriginalString.EndsWith("rels"))
{
continue;
}
var part2 = package2.GetPart(part1.Uri);
var hash1 = GetFileHash(part1);
var hash2 = GetFileHash(part2);
Assert.AreEqual(hash1,hash2, part1.Uri.OriginalString);
}
}
}
示例4: Update
void Update()
{
timeSinceStart = Time.time;
if (!runnerReady)
{
runner = FindObjectOfType<Runner>() as Runner;
if (runner != null)
{
runnerReady = true;
}
}
else
{
credField.text = runner.credits.ToString();
tagField.text = runner.tags.ToString();
linksField.text = runner.links.ToString();
memField.text = runner.mem.ToString();
scoreField.text = runner.agendaPts.ToString();
}
switch (state)
{
case "menu":
break;
case "normal":
break;
case "run":
break;
}
}
示例5: SetUp
public void SetUp()
{
_runner = RunnerHelper.Create();
_runner.RunInitializers(this);
// consolidate data from initializers and execute batch process here
}
示例6: BuildTools
/// <summary>
/// Constructor for the form
/// </summary>
public BuildTools(Guid guid, Job job)
{
InitializeComponent();
_job = job;
_googleAnalytics = new GoogleAnalytics(guid);
_runner = new Runner(this, _job, _googleAnalytics);
undoBT.Visible = false;
progress.Visible = false;
versionBox.SelectedIndex = 0;
GetVersions();
// delegates
_appendDelegate = AppendText;
_appendRawDelegate = AppendRawText;
_disableDelegate = Disable;
_enableDelegate = Enable;
_showProgressDelegate = ProgressShow;
_hideProgressDelegate = ProgressHide;
_indeterminateProgressDelegate = ProgressIndeterminate;
_progressPercentDelegate = Progress;
_updateVersionsDelegate = UpdateVersions;
if (File.Exists(Program.CheckUpdate)) {
string text = File.ReadAllText(Program.CheckUpdate);
if (string.IsNullOrEmpty(text) || text.Trim().ToLower() == "false") {
autoUpdateCB.Checked = false;
}
}
Console.WriteLine(guid.ToString());
new Thread(delegate () {
_googleAnalytics.SendEvent("Application", "Start");
}).Start();
}
示例7: CanGoToFavourites
public void CanGoToFavourites()
{
using (var runner = new Runner<FavouritesTask>())
{
runner.Execute();
}
}
示例8: Should_identify_test_container
public void Should_identify_test_container()
{
var runner = new Runner();
var assembly = getPath("AutoTest.TestRunners.XUnit.Tests.TestResource.dll");
var cls = "AutoTest.TestRunners.XUnit.Tests.TestResource.Class1";
Assert.That(runner.ContainsTestsFor(assembly, cls), Is.True);
}
示例9: Execute
public override bool Execute()
{
var stopwatch = Stopwatch.StartNew();
BuildEngine.LogMessageEvent(new BuildMessageEventArgs(string.Format("Pepita (version {0}) Executing", GetType().Assembly.GetName().Version), "", "Pepita", MessageImportance.High));
try
{
GetProjectPath(Console.Out);
var runner = new Runner
{
ProjectDirectory = ProjectDirectory,
SolutionDirectory = SolutionDirectory,
WriteInfo = s => BuildEngine.LogMessageEvent(new BuildMessageEventArgs("\t" + s, "", "Pepita", MessageImportance.High)),
};
runner.Execute();
}
catch (ExpectedException expectedException)
{
BuildEngine.LogErrorEvent(new BuildErrorEventArgs("", "", "", 0, 0, 0, 0, string.Format("Pepita: {0}", expectedException.Message), "", "Pepita"));
return false;
}
catch (Exception exception)
{
BuildEngine.LogErrorEvent(new BuildErrorEventArgs("", "", "", 0, 0, 0, 0, string.Format("Pepita: {0}", exception), "", "Pepita"));
return false;
}
finally
{
stopwatch.Stop();
BuildEngine.LogMessageEvent(new BuildMessageEventArgs(string.Format("\tFinished ({0}ms)", stopwatch.ElapsedMilliseconds), "", "Pepita", MessageImportance.High));
}
return true;
}
示例10: Should_identify_test
public void Should_identify_test()
{
var runner = new Runner();
var assembly = getPath("AutoTest.TestRunners.XUnit.Tests.TestResource.dll");
var method = "AutoTest.TestRunners.XUnit.Tests.TestResource.Class1.Should_pass";
Assert.That(runner.IsTest(assembly, method), Is.True);
}
示例11: Bar
static async void Bar()
{
Runner<HttpClient> a = new Runner<HttpClient>();
FileSystemTemplateSource b = new FileSystemTemplateSource();
await a.ExecuteSingle(await b.LoadTemplate("test.json"));
}
示例12: Test1
public void Test1()
{
Runner r = new Runner();
Thread[] threads = new Thread[50];
Console.WriteLine("Creating threads...");
for (int i = 0; i < threads.Length; ++i)
{
threads[i] = new Thread(new ThreadStart(r.ThreadProc));
}
Console.WriteLine("Starting threads...");
for (int i = 0; i < threads.Length; ++i)
{
threads[i].Start();
}
Console.WriteLine("Waiting for threads to join...");
for (int i = 0; i < threads.Length; ++i)
{
threads[i].Join();
}
Console.WriteLine("Joined. Got {0} keys", r.GeneratedKeys.Count);
r.GeneratedKeys.Sort();
for (int i = 0; i < r.GeneratedKeys.Count - 1; ++i)
{
Assert.IsTrue((int)r.GeneratedKeys[i] != (int)r.GeneratedKeys[i + 1]);
}
Console.WriteLine("Generated keys confirmed to be unique.", r.GeneratedKeys.Count);
}
示例13: Run
public static void Run(Tree<string> tree, Tuple<double, Rect> seed)
{
Func<StateMonad<Tuple<double, Rect>, Tuple<double, Rect>>> leftUpdater = () =>
new StateMonad<Tuple<double, Rect>, Tuple<double, Rect>>(m =>
{
var depth = m.First;
var rect = m.Second;
var newDepth = depth + 1.0;
var multiplier = 2.0 * newDepth;
var nextRect = new Rect(rect.Height, rect.Width / multiplier, rect.Top, rect.Left + rect.Width / multiplier);
var currRect = new Rect(rect.Height, rect.Width / multiplier, rect.Top, rect.Left);
return Tuple.Create(Tuple.Create(newDepth, nextRect), Tuple.Create(newDepth, currRect));
});
Func<StateMonad<Tuple<double, Rect>, Tuple<double, Rect>>> rightUpdater = () =>
new StateMonad<Tuple<double, Rect>, Tuple<double, Rect>>(m =>
{
var depth = m.First;
var rect = m.Second;
var newDepth = depth - 1.0;
var nextRect = new Rect(rect.Height, rect.Width * 2, rect.Top, rect.Left + rect.Width);
return Tuple.Create(Tuple.Create(newDepth, nextRect), m);
});
var runner = new Runner<Tuple<double, Rect>, string>(leftUpdater, rightUpdater);
Console.WriteLine();
Console.WriteLine("Exercise 2: Tree within bounded rects:");
var rectTree = runner.MLabel(tree, seed);
rectTree.Show(2);
Console.WriteLine();
}
示例14: Main
public static int Main(string[] args)
{
var consoleWriter = new ConsoleWriter();
try
{
var settings = new SaucySettings();
ILogger logger = new VerboseLogger();
var restoreVerb = new SaucyCommandLine(
new PackagesRestorer(
new JsonLoader(),
new ProviderMatcher(new GitHubProvider(new FolderSync(logger))),
consoleWriter,
settings),
settings);
var runner = new Runner();
runner.Register(restoreVerb);
var exitCode = runner.Run(args);
return exitCode;
}
catch (Exception e)
{
consoleWriter.Write(e.Message);
consoleWriter.Write(e.StackTrace);
return -1;
}
}
示例15: Execute
public override bool Execute()
{
var stopwatch = Stopwatch.StartNew();
BuildEngine.LogMessageEvent(new BuildMessageEventArgs(string.Format("PepitaPackage (version {0}) Executing", GetType().Assembly.GetName().Version), "", "Pepita", MessageImportance.High));
try
{
ValidatePackageDir();
var runner = new Runner
{
PackageDirectory = NuGetBuildDirectory,
MetadataAssembly = MetadataAssembly,
Version = Version,
TargetDir = TargetDir,
WriteInfo = s => BuildEngine.LogMessageEvent(new BuildMessageEventArgs("\t" + s, "", "Pepita", MessageImportance.High)),
};
runner.Execute();
}
catch (ExpectedException expectedException)
{
BuildEngine.LogErrorEvent(new BuildErrorEventArgs("", "", "", 0, 0, 0, 0, string.Format("Pepita: {0}", expectedException.Message), "", "Pepita"));
return false;
}
catch (Exception exception)
{
BuildEngine.LogErrorEvent(new BuildErrorEventArgs("", "", "", 0, 0, 0, 0, string.Format("Pepita: {0}", exception), "", "Pepita"));
return false;
}
finally
{
stopwatch.Stop();
BuildEngine.LogMessageEvent(new BuildMessageEventArgs(string.Format("\tFinished ({0}ms)", stopwatch.ElapsedMilliseconds), "", "Pepita", MessageImportance.High));
}
return true;
}