public void RunAction_DisposesOfContainer() { bool disposed = false; var container = new ExportFactory<TestResolveClass>(() => new Tuple<TestResolveClass,Action>(new TestResolveClass(),() => disposed = true)); var sut = new ScopedAction<TestResolveClass>(container); sut.RunAction(CancellationToken.None); Assert.That(disposed, Is.True); }
public void RunAction_RunsConstructedClassWithProvidedCancellationToken() { var resolvedClass = new TestResolveClass(); var container = new ExportFactory<TestResolveClass>(() => new Tuple<TestResolveClass, Action>(resolvedClass, () => { })); var sut = new ScopedAction<TestResolveClass>(container); var cancellationToken = CancellationToken.None; sut.RunAction(cancellationToken); Assert.That(resolvedClass.Token, Is.EqualTo(cancellationToken)); }