Exemplo n.º 1
0
        public void SetupRecurringJob()
        {
            // arrange
            var wasExecuted = false;
            var sut         = new HangfireRecurringFixture();

            HangfireHelperFixture.RegisterType(typeof(HangfireRecurringFixture), ref sut);

            sut.ActionToExecute += () =>
            {
                wasExecuted = true;
            };

            // act
            sut.Setup();
            Thread.Sleep(65000);

            // assert
            wasExecuted.Should().BeTrue();
        }
Exemplo n.º 2
0
        public void SetUpFireAndForgetJob()
        {
            // arrange
            var wasExecuted = false;
            var sut         = new HangfireJobBaseFixture();

            HangfireHelperFixture.RegisterType(typeof(HangfireJobBaseFixture), ref sut);

            sut.TestInvokeAction += () =>
            {
                wasExecuted = true;
            };

            // act
            sut.Setup();
            //TODO - This makes the test brittle, think of a better way to do this
            Thread.Sleep(30000);

            // assert
            wasExecuted.Should().BeTrue();
        }