public void InstanceSchedule_ThrowsAnException_WhenClientIsNull()
        {
            var exception = Assert.Throws <ArgumentNullException>(
                () => BackgroundJobClientExtensions.Schedule <BackgroundJobClientExtensionsFacts>(
                    null, x => x.InstanceMethod(), TimeSpan.FromDays(1)));

            Assert.Equal("client", exception.ParamName);
        }
示例#2
0
        public void InstanceSchedule_WithDateTimeOffset_ThrowsAnException_WhenClientIsNull()
        {
            var exception = Assert.Throws <ArgumentNullException>(
                () => BackgroundJobClientExtensions.Schedule <BackgroundJobClientExtensionsFacts>(
                    null, x => x.InstanceMethod(), DateTimeOffset.UtcNow));

            Assert.Equal("client", exception.ParamName);
        }
        public void StaticSchedule_ThrowsAnException_WhenClientIsNull()
        {
            var exception = Assert.Throws <ArgumentNullException>(
                () => BackgroundJobClientExtensions.Schedule(
                    null, () => StaticMethod(), TimeSpan.FromDays(1)));

            Assert.Equal("client", exception.ParamName);
        }
示例#4
0
        public void StaticSchedule_WithDateTimeOffset_ThrowsAnException_WhenClientIsNull()
        {
            var exception = Assert.Throws <ArgumentNullException>(
                () => BackgroundJobClientExtensions.Schedule(
                    null, () => StaticMethod(), DateTimeOffset.UtcNow));

            Assert.Equal("client", exception.ParamName);
        }
示例#5
0
        public void GenericScheduleShouldThrowException_WithSetRunTime_ForInstanceMethodCall_FromFuncTaskTypedExpression_WhenClientIsNull()
        {
            var runAt = DateTime.UtcNow.AddHours(1);

            Expression <Func <TestClass, Task> > methodCall = x => x.TestInstanceTaskMethod();

            var exception = Assert.Throws <ArgumentNullException>(
                () => BackgroundJobClientExtensions.Schedule <TestClass>(
                    null, methodCall, runAt));

            Assert.Equal("client", exception.ParamName);
        }
示例#6
0
        public void ScheduleShouldThrowException_WithSetRunTime_ForStaticMethodCall_FromActionTypedExpression_WhenClientIsNull()
        {
            var runAt = DateTime.UtcNow.AddHours(1);

            Expression <Action> methodCall = () => TestClass.TestStaticMethod();

            var exception = Assert.Throws <ArgumentNullException>(
                () => BackgroundJobClientExtensions.Schedule(
                    null, methodCall, runAt));

            Assert.Equal("client", exception.ParamName);
        }
示例#7
0
        public void ScheduleShouldThrowException_WithDelay_ForStaticMethodCall_FromFuncTaskTypedExpression_WhenClientIsNull()
        {
            var runAt = DateTime.UtcNow.AddHours(1);
            var delay = runAt.Subtract(DateTime.UtcNow);

            Expression <Func <Task> > methodCall = () => TestClass.TestStaticTaskMethod();

            var exception = Assert.Throws <ArgumentNullException>(
                () => BackgroundJobClientExtensions.Schedule(
                    null, methodCall, delay));

            Assert.Equal("client", exception.ParamName);
        }
示例#8
0
        public void GenericScheduleShouldThrowException_WithDelay_ForInstanceMethodCall_FromActionTypedExpression_WhenClientIsNull()
        {
            var runAt = DateTime.UtcNow.AddHours(1);
            var delay = runAt.Subtract(DateTime.UtcNow);

            Expression <Action <TestClass> > methodCall = x => x.TestInstanceMethod();

            var exception = Assert.Throws <ArgumentNullException>(
                () => BackgroundJobClientExtensions.Schedule <TestClass>(
                    null, methodCall, delay));

            Assert.Equal("client", exception.ParamName);
        }