コード例 #1
0
        public void Cancelled_Type_Task_T_Should_Be_Cancelled()
        {
            var target = TaskBuilder.GetCancelled(typeof(Task <int>));

            target.IsCanceled.Should().BeTrue();
            target.Should().BeOfType <Task <int> >();
        }
コード例 #2
0
        public void Cancelled_Type_Task_Should_Be_Cancelled()
        {
            var target = TaskBuilder.GetCancelled(typeof(Task));

            target.IsCanceled.Should().BeTrue();
            target.Should().BeAssignableTo <Task>();
        }
コード例 #3
0
        public void Intercept(IInvocation invocation)
        {
            if (TypeHelper.IsActorCompleteLifeCycleTypeOrBase(invocation.Method.DeclaringType))
            {
                Cancel(invocation);
                return;
            }

            var actor = GetCorrectActor();

            if (actor != null)
            {
                invocation.ReturnValue = invocation.CallOn(actor);
            }
            else
            {
                invocation.ReturnValue = TaskBuilder.GetCancelled(invocation.Method.ReturnType);
            }
        }
コード例 #4
0
        public void Cancelled_Type_Object_Should_Be_Null()
        {
            var target = TaskBuilder.GetCancelled(typeof(object));

            target.Should().BeNull();
        }