Exemple #1
0
        public void the_constructor_should_assign_the_value_to_the_property()
        {
            var scope = Substitute.For <IContainerScope>();

            var sut = new ScopeCreatedEventArgs(scope);

            sut.Scope.Should().BeSameAs(scope);
        }
        public void trigger_ScopeCreated_event_before_running_the_job()
        {
            var sl    = Substitute.For <IContainer>();
            var scope = Substitute.For <IContainerScope>();
            ScopeCreatedEventArgs actual = null;
            var job = Substitute.For <IBackgroundJob>();

            sl.CreateScope().Returns(scope);
            scope.Resolve(job.GetType()).Returns(job);
            scope.ResolveAll <IBackgroundJob>().Returns(new[] { job });

            var sut = new BackgroundJobManager(sl);

            sut.ScopeCreated += (o, e) => actual = e;
            sut.StartInterval = TimeSpan.FromSeconds(0);
            sut.Start();
            Thread.Sleep(100);


            actual.Should().NotBeNull();
        }
 private void OnCommandScope(object sender, ScopeCreatedEventArgs e)
 {
 }