public void JobExistsWithAssemblyQualifiedName() { ILog logger = GetLogger(); IAsyncCommandContainer container = new AsyncCommandContainer(new AsyncCommandItemTimeSpan(), logger); var asyncFunc = new Mock<IAsyncCommand> { DefaultValue = DefaultValue.Mock }; container.Add(asyncFunc.Object, "", asyncFunc.Object.DecoratedCommand.GetType()); bool exists = container.Exists("", asyncFunc.Object.DecoratedCommand.GetType()); Assert.IsTrue(exists); }
public void JobRemovedFromContainerAfterRemovalTimeElapsed() { var wait = new ManualResetEvent(false); var asyncFunc = new Mock<IAsyncCommand>(); var timeSpan = new Mock<IAsyncCommandItemTimeSpan>(); ILog logger = GetLogger(); asyncFunc.Setup(a => a.Progress.Status).Returns(StatusEnum.Finished); timeSpan.Setup(t => t.Time).Returns(new TimeSpan(0, 0, 0, 0, 1)); var container = new AsyncCommandContainer(timeSpan.Object, logger); container.Add(asyncFunc.Object, "", asyncFunc.Object.GetType()); container.SetInactive("", asyncFunc.Object.GetType()); container.GetContainerItem("", asyncFunc.Object.GetType()).OnItemRemoved += () => wait.Set(); wait.WaitOne(3000); Assert.IsFalse(container.Exists("", asyncFunc.Object.GetType())); }