public void TestTimingOutATask() { var sut = new TaskExample(); var result = sut.TimingOutATask(); Assert.AreEqual(0, result); }
public void TestWaitAny() { var sut = new TaskExample(); var result = sut.WaitAny(); Assert.AreEqual(6, result); }
public void TestChildTasks() { var sut = new TaskExample(); var result = sut.ChildTasks(); Assert.AreEqual(3, result); }
public void TestTaskFactory() { var sut = new TaskExample(); var result = sut.TaskFactory(); Assert.AreEqual(3, result); }
public void TestCancellingATask() { var sut = new TaskExample(); var result = sut.CancellingATask(); Assert.AreEqual(true, result); }
public void TestNewAndStart() { var sut = new TaskExample(); sut.StartAndWait(); Assert.IsTrue(sut.IsSet); }
public void TestResult() { var sut = new TaskExample(); var result = sut.Result(); Assert.IsTrue(sut.IsSet); Assert.IsTrue(result); }
public void TestContinuationTask() { var sut = new TaskExample(); var result = sut.ContinuationTask(); Assert.IsTrue(sut.IsSet); Assert.IsFalse(result); }
public void TestStartNew() { var sut = new TaskExample(); sut.StartNew(); Assert.IsTrue(sut.IsSet); }
public void TestContinuationTaskAgain() { var sut = new TaskExample(); var result = sut.ContinuationTaskAgain(); Assert.IsTrue(sut.IsSet); Assert.AreEqual("OnlyOnRanToCompletion", result); }
public void TestStartAndRunSynchronously() { var sut = new TaskExample(); sut.RunSynchronously(); Assert.IsTrue(sut.IsSet); }
public void Configuration(IAppBuilder app) { app.UseHangfireServer(); app.UseHangfireDashboard(string.Empty); var taskExample = new TaskExample(); RecurringJob.AddOrUpdate(() => taskExample.TaskMethod(null), Cron.Minutely); }
public TasksDictionary(string name, int lvls, GameType game, int num) { orderNumber = ++num; gameType = game; this.name = name; localizedName = name; Levels = new TaskExample[lvls]; for (int i = 0; i < Levels.Length; i++) { Levels[i] = new TaskExample(i); } }
static void Main(string[] args) { var exampleToRun = ExamplesEnumeration.MultipleParameters; switch (exampleToRun) { case ExamplesEnumeration.BasicTask: TaskExample.ShowTask(); break; case ExamplesEnumeration.WithParameters: TaskExample.ShowTaskWithParameters(); break; case ExamplesEnumeration.TaskStatus: TaskExample.ShowTaskStatus(); break; case ExamplesEnumeration.IsBackground: IsBackgroupExample.ShowIsBackground(); break; case ExamplesEnumeration.Wait: WaitExample.ShowWaitTask(); break; case ExamplesEnumeration.WaitAllOrAny: WaitExample.ShowWaitAllOrAny(); break; case ExamplesEnumeration.TaskFactory: TaskFactoryExample.ShowTaskFactory(); break; case ExamplesEnumeration.ContinueWith: TaskContinuationExample.ShowTaskContinuation(); break; case ExamplesEnumeration.Result: TaskResultExample.ShowTaskResult(); break; case ExamplesEnumeration.MultipleParameters: MultipleParametersExample.ShowMultipleParameters(); break; } Console.Read(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } ApplicationLogging.LoggerFactory = loggerFactory; app.UseHangfireServer(); app.UseHangfireDashboard(string.Empty); var taskExample = new TaskExample(); RecurringJob.AddOrUpdate(() => taskExample.TaskMethod(null), Cron.Minutely); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHangfireServer(); app.UseHangfireDashboard(); app.Run(async(context) => { await context.Response.WriteAsync("Hello World!"); }); var taskExample = new TaskExample(); RecurringJob.AddOrUpdate(() => taskExample.TaskMethod(null), Cron.Minutely); }
private static void Lesson3() { //CHECKTHAT!!!!!!!!!!! MutexExample.DoWork(); Console.WriteLine($"Main thread id#{Thread.CurrentThread.ManagedThreadId}"); //TaskExample.DoColdTask(); //TaskExample.DoHotTask(); //TaskExample.DoTaskWithContinuation(); //TaskExample.DoTaskWithCatchingException(); /*var task = TaskExample.DivideAsync(5, 3); * Console.WriteLine(task.Result);*/ CancellationTokenSource cts = new CancellationTokenSource(); Task.Run(() => { Thread.Sleep(3000); cts.Cancel(); }); TaskExample.CalculateWithCancellation(cts.Token); cts.Cancel(); }
public void SetUpNode() { node = new TaskExample(); }
public void CreateTask() { task = new TaskExample(); }