##// END OF EJS Templates
Added awaiters to promises...
Added awaiters to promises Added static methods to Promise Resolve, Reject, All. Updated promise helpers

File last commit:

r208:7d07503621fe v2
r248:5cb4826c2c2a v3
Show More
MockRunnableComponent.cs
52 lines | 1.3 KiB | text/x-csharp | CSharpLexer
/ Implab.Test / Mock / MockRunnableComponent.cs
using System;
using Implab.Components;
namespace Implab.Test.Mock {
class MockRunnableComponent : RunnableComponent {
public MockRunnableComponent(bool initialized) : base(initialized) {
}
public MockRunnableComponent(bool initialized, bool reusable) : base(initialized, reusable) {
}
public Action MockInit {
get;
set;
}
public Func<IPromise> MockStart {
get;
set;
}
public Func<IPromise> MockStop {
get;
set;
}
public Action<bool> MockDispose {
get;
set;
}
protected override IPromise OnStart() {
return MockStart != null ? Safe.Run(MockStart).Chain(base.OnStart) : Safe.Run(base.OnStart);
}
protected override IPromise OnStop() {
return MockStop != null ? Safe.Run(MockStop).Chain(base.OnStop) : Safe.Run(base.OnStop);
}
protected override void OnInitialize() {
if (MockInit != null)
MockInit();
}
protected override void Dispose(bool disposing) {
if (MockDispose != null)
MockDispose(disposing);
base.Dispose(disposing);
}
}
}